#include<iostream>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
int main(int argc,char* argv[])
{
    map<string,int> mp;
    vector<pair<string,string> >vec;
    string inputStr;
    while(getline(cin, inputStr))
    {
        int pos1=inputStr.find(" ");
        int pos2=inputStr.rfind("\\");
        string row=inputStr.substr(pos1+1);
        string file=inputStr.substr(pos2+1,pos1-pos2-1);
        if(file.length()>16) file=file.substr(file.length()-16);
        string key=file+"_"+row;
        if(mp.count(key)==0)
        {
            mp[key]=1;
            vec.push_back(make_pair(file,row));
        }else{
            mp[key]++;
        }
    }
    int i=vec.size()>8 ? vec.size()-8:0;
    for(;i<vec.size();i++)
    {
        string key=vec[i].first+"_"+vec[i].second; 
        cout<<vec[i].first.c_str()<<" "<<vec[i].second.c_str()<<" "<<mp[key]<<endl;
    }
    return 0;
}