#include <iostream>
#include <map>

using namespace std;

int main()
{
    map<int, int> ans;
    char ch;
    int id, day;

    while (cin >> id >> ch >> day) 
        ans[id]++;

    map<int, int>::iterator it = ans.begin();
    while (it != ans.end()) {
        if ((*it).second >= 2)
            cout << (*it).first << " " << (*it).second << endl;
        it++;
    }

    return 0;
}