#include<stdio.h>
#include<string.h>
typedef struct ErrRecord
{
char name[20];
int line;
int count;
}ErrRecord;
int main()
{
ErrRecord record[100];
int rindex = -1;
char str[100];
int line;
while(EOF != scanf("%s%d",str,&line))
{
int i,j;
int len = strlen(str);
char name[20];
for(i=len-1;i>=0;i--)
{
if(str[i] == '\\')
break;
}
//从i+1 下一位开始复制,还有考虑长度不能超过16
if(i+1 < len -16)
{
strcpy(name, str+len-16);
}else {
strcpy(name, str+i+1);
}
int flag = 0; //标志能否在前面发现相同的记录 1:发现,0:未发现。
for(i=0;i<=rindex;i++)
{
if( (0 == strcmp(name, record[i].name)) && (line == record[i].line) )
{
record[i].count++;
flag = 1;
break;
}
}
if(0 == flag)
{
++rindex;
strcpy(record[rindex].name, name);
record[rindex].line = line;
record[rindex].count = 1;
}
}
if(rindex<8)
{
for(int i=0;i<=rindex;i++)
{
printf("%s %d %d \n",record[i].name,record[i].line,record[i].count);
}
}else {
for(int i=rindex-7;i<=rindex;i++)
{
printf("%s %d %d \n",record[i].name,record[i].line,record[i].count);
}
}
return 0;
}