1. 

/*
* ACM Contest training
* Problem: 755 - 487--3279
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=9&page=show_problem&problem=696
*
* @author Christoph Goettschkes
* @version 1.0, 10/24/2010
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 2.496
*/

import java.io.*;
import java.util.*;

class Main
{
public static void main(String[] args) throws Exception
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

int datasets = Integer.parseInt(reader.readLine());




for (int i = 0; i < datasets; i++)
{
reader.readLine();

Map<String, Integer> mapper = new TreeMap<String, Integer>();
int telephoneNumbers = Integer.parseInt(reader.readLine());

for (int j = 0; j < telephoneNumbers; j++) {

String tel = reader.readLine().toLowerCase();
StringBuilder realNumber = new StringBuilder();
for (char c : tel.toCharArray()) {
if (realNumber.length() == 3)
realNumber.append('-');
if (c == '-')
continue;
if (c == 'a' || c == 'b' || c == 'c')
realNumber.append(2);
else if (c == 'd' || c == 'e' || c == 'f')
realNumber.append(3);
else if (c == 'g' || c == 'h' || c == 'i')
realNumber.append(4);
else if (c == 'j' || c == 'k' || c == 'l')
realNumber.append(5);
else if (c == 'm' || c == 'n' || c == 'o')
realNumber.append(6);
else if (c == 'p' || c == 'r' || c == 's')
realNumber.append(7);
else if (c == 't' || c == 'u' || c == 'v')
realNumber.append(8);
else if (c == 'w' || c == 'x' || c == 'y')
realNumber.append(9);
else
realNumber.append(c);
}
if (mapper.containsKey(realNumber.toString())) {
Integer c = mapper.get(realNumber.toString());
mapper.put(realNumber.toString(), ++c);
} else {
mapper.put(realNumber.toString(), 1);
}
}

boolean output = false;
for (String s : mapper.keySet()) {
Integer c = mapper.get(s);
if (c > 1) {
System.out.println(s + " " + mapper.get(s));
output = true;
}
}
if (!output)
System.out.println("No duplicates.");

if (i + 1 != datasets)
System.out.println("");
}
}
}