#include<iostream>
#include<string>
#include<list>
using namespace std;
struct record{
string name;
int line;
int count;
};
string getname(string str)
{
int sz = str.length();
int i;
for(i=sz-1; i>=0 && str[i]!='\\'; i-- );
if(sz-1-i>16)
return str.substr(sz-16);
else
return str.substr(i+1);
}
int main()
{
list<record> listrd;
string str;
int num;
while(cin>>str>>num)
{
string name = getname(str);
int line = num;
record rd;
bool exist = false;
for(list<record>::iterator itr=listrd.begin(); itr!=listrd.end(); itr++)
{
if((*itr).name == name && (*itr).line == line)
{
exist = true;
(*itr).count++;
}
}
if(exist==false)
{
if(listrd.size()==8)
{
listrd.pop_front();
}
rd.name = name;
rd.line = line;
rd.count = 1;
listrd.push_back(rd);
}
}
for(list<record>::iterator itr=listrd.begin(); itr!=listrd.end(); itr++)
{
cout<<(*itr).name<<' '<<(*itr).line<<' '<<(*itr).count<<endl;
}
return 0;
}