#include<iostream>
#include<string>
#include<cstdlib>
using std::string;
using namespace std;
int n;
char a[100001][20],str[50];
char map[]="222333444555666777888999";
int compare(const void *p,const void*q)
{
return(strcmp((char*)p,(char*)q));
}
int main()
{
while(scanf("%d",&n)!=EOF)
{
for(int i=0;i<n;++i)
{
int flag=0;
scanf("%s",str);//
int j=0,k=0;
while(k<8)
{
if(k==3)
{
a[i][k++]='-';//把a[][]的第四位存储为'-'
continue;
}
if(str[j]<='Z' && str[j]>='A')
{
a[i][k++]=map[str[j++]-'A'];//把24个字母中的某一个转换为相应的数字 存储在a[][]中
continue;
}
else if(str[j]=='-')
{
j++;
continue;
}
a[i][k++]=str[j++];//如果是纯数字 直接存储
}
a[i][8]='\0';//字符串的最后一位位0字符
}
qsort(a,n,20,compare);//快速排序
int noduplicates=1;
int p,q;
p=0;
while(p<n)
{
q=p;
p++;//首先加一
while(p<n && !strcmp(a[p],a[q]))p++;//两个字符串相等 p++
if(p-q>1)
{
printf("%s %d\n",a[q],p-q);
noduplicates=0;
}
}
if(noduplicates)printf("No duplicates.\n");
}
return 0;
}