import sys
path_dict={}
for line in sys.stdin:
    path,line_number = line.split() #取出文件路径和行号
    path_end = path.split('\\')[-1] #取出文件短路径
    path16 = path_end[-16:]#取文件名后16位的短文件名
    path_key = path16+' '+line_number #短文件名和行号组合成新索引
    path_dict[path_key] = path_dict.get(path_key,0) + 1 # 建立字典,当key不存在时返回0,进行累加

key_8 = list(path_dict.keys())[-8:] #取最后6位输出
for i in key_8:
    print(f'{i} {path_dict[i]}')