#include <stdio.h>
#include <string.h>
int main(){
    char str[101];
    int n;
    char note[100][17] = {'0'};   //记录日志,记100条,只输出后8条   ???为啥必须是17,不能是16
    int row[100] = {0};     //记录错误代码行号
    int num[100] = {0};     //记录错误次数
    int flag = -1;         //记录日志最后一条的位置,初始没有记录,记为-1
    while(scanf("%s%d",str,&n) != EOF){
        //截取最后路径,并保证在 16 位内
        char *p = strrchr(str, '\\');  //\cqzlyaszjvlsjmkwoqijggmybr
        p = strchr(p,p[1]);          //去除首位反斜杠
        int len = strlen(p);
        if(len > 16){
            p = p + (len -16);
            len = 16;
        }
        int i;
        for(i = 0; i <= flag; i++){//进行字符串、错误行数比较
            if((strcmp(note[i],p) == 0) && (row[i] == n)){
                num[i] = num[i] + 1;        //有记录,记录加 1
                break;
            }
        }
        if(i == flag + 1){   //没有匹配的,那就是新记录,直接存放
            flag = flag + 1;
            strcpy(note[flag],p);
            row[flag] = n;
            num[flag] = 1;
        }
    }
    if(flag < 8){
        for(int i = 0; i <= flag; i++){
            printf("%s %d %d\n",note[i],row[i],num[i]);
        }
    }else{
        for(int i = flag - 7; i <= flag; i++){
            printf("%s %d %d\n",note[i],row[i],num[i]);
        }
    }
    return 0;
}