//
// main.cpp
// JudgeTest
//
// Created by 彭凌群 on 2017/8/3.
// Copyright © 2017年 彭凌群. All rights reserved.
//
#include <iostream>
#include <map>
#include <vector>
#include<algorithm>
#include <string>
using namespace std;
char num[] = {
2,2,2,
3,3,3,
4,4,4,
5,5,5,
6,6,6,
7,7,7,7,
8,8,8,
9,9,9
};
int convertStr(char* a)
{
char len = (char)strlen(a);
int ret = 0;
for (char c = 0; c < len; ++c)
{
if (a[c] >= '0' and a[c] <= '9') {
ret = ret * 10 + a[c] - '0';
}
else if(a[c] >='A' and a[c] < 'Z' and a[c] != 'Q')
{
ret = ret * 10 + num[a[c] - 'A'];
}
}
return ret;
}
void test1002()
{
unsigned int loopCount = 0;
cin >> loopCount;
char oriNO[80];
map<int,int> mt_map;
bool ok = false;
for(int i = loopCount; i; --i)
{
cin >> oriNO;
int key = convertStr(oriNO);
if (mt_map[key]) {
++mt_map[key];
ok = true;
}
else
{
mt_map[key] = 1;
}
}
if (not ok) {
cout << "No duplicates." << endl;
return;
}
for (map<int,int>::iterator it = mt_map.begin(), itEnd = mt_map.end(); it != itEnd; ++it)
{
if (it->second>1) {
printf("%03d-%04d %d\n", it->first/10000, it->first%10000, it->second);
}
}
}
int main() {
test1002();
return 0;
}