#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char map[] = "22233344455566670778889990";//map - 映射处理-Q,Z 对应的位置可以任何数字, 我用 0 表示 
char str[ 80 ], Numbers[ 100001 ][ 9 ];
int compare( const void * elem1, const void *elem2 )
{
	return ( strcmp( (char * )elem1, (char *)elem2));
}
void standardizeTel( int n)
{
	int i, j,k;
	j = k = -1;
	while( k < 8 )
	{
		j++;
		if(str[j] == '-')
		continue;
		k++;
		if(k == 3)
		{
			Numbers[n][k]= '-';     //加 ' - ' 
			k++;
		}
		if(str[j] >= 'A' && str[j] <= 'Z')
		{
			Numbers[n][k] = map[str[j]- 'A']; //处理 
			continue;
		}
		Numbers[n][k] = str[j];
	}
	Numbers[n][k] = '\0';   //加'\0' 

}
int main()
{
	int n, i, j;
	int flag;
	scanf( "%d", &n);
	for( i = 0; i< n; i++ )
	{
		scanf( "%s", str);   //输入 
		standardizeTel(i);   //化为标准形式 
	}
	qsort(Numbers, n, 9, compare);  //排序 
	flag = 1;   //判断标记 
	i = 0;
	while( i < n)
	{
		j = i; 
		i++; 
		while( i<n && strcmp(Numbers[i],Numbers[j]) == 0)    //判断是否前后是否相等,输出 
			i++;
		if(i - j > 1)
		{
			printf( "%s %d\n", Numbers[j], i - j );
			flag = 0;
		}
	}
	if(flag)
		printf("No duplicates.\n");
	return 0;
}