#include<iostream>
#include<cstring>
#include<algorithm>
#include<cctype>
using namespace std;
int data[100005];
int main(){
memset(data,0,sizeof(data));
char ch_alpha[] = {'A','B','C','D','E','F','G','H','I',
'J','K','L','M','N','O','P','Q','R',
'S','T','U','V','W','X','Y'
};
int num[] = {2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,0,7,7,8,8,8,9,9,9};
int i,j,n,temp,count = 0;
scanf("%d",&n);
char a[80];
for(i=0;i<n;i++){
scanf("%s",a);
temp = 0;
for(j=0;j<strlen(a);j++){
if(isalpha(a[j])){
temp *= 10;
temp += num[a[j]-'A'];
}
else if(isdigit(a[j])){
temp *= 10;
temp += a[j]-'0';
}
}
data[count++] = temp;
}
sort(data,data+n);
bool flag = true;
temp = data[0];
count = 1;
for(i=1;i<n;i++){
if(temp==data[i]){
flag = false;
count++;
}
else{
if(count>1){
printf("%03d-%04d %d\n",temp/10000,temp%10000,count);
}
temp = data[i];
count = 1;
}
}
if(count>1){
printf("%03d-%04d %d\n",temp/10000,temp%10000,count);
}
if(flag)
printf("No duplicates.\n");
return 0;
}