#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
char buf[1 << 20];
int mp[128];
int main()
{
    mp['A'] = mp['B'] = mp['C'] = 2;
    mp['D'] = mp['E'] = mp['F'] = 3;
    mp['G'] = mp['H'] = mp['I'] = 4;
    mp['J'] = mp['K'] = mp['L'] = 5;
    mp['M'] = mp['N'] = mp['O'] = 6;
    mp['P'] = mp['R'] = mp['S'] = 7;
    mp['T'] = mp['U'] = mp['V'] = 8;
    mp['W'] = mp['X'] = mp['Y'] = 9;
    for (int i = 0; i < 10; i++)
        mp[i + '0'] = i;
    int n;
    map<int, int> M;
    while (cin >> n)
    {
        M.clear();
        while (n--)
        {
            scanf("%s", buf);
            int cur = 0;
            for (char *p = buf; *p; p++)
                if (*p != '-')
                    cur = cur * 10 + mp[*p];
            M[cur]++;
        }
        bool flag = true;
        for (map<int, int>::iterator ite = M.begin(); ite != M.end(); ++ite)
            if (ite->second > 1)
                printf("%03d-%04d %d\n", ite->first / 10000, ite->first % 10000, ite->second), flag = false;
        if (flag) puts("No duplicates.");
    }
    return 0;
}
