用两个字典来维护排序数。一个记录出现的次数,一个记录出现先后。

dict_num={}#用于维护行数数目
dict_appear={}#用于维护记录出现的次数
dict_order={}#用于维护总的排序树
n = 0
while 1:
    try:
        s = input().split('\\')[-1]
        data = s.split(' ')[0][-16:] + ' ' + s.split(' ')[1]
        if data not in dict_num:
            dict_num[data] = 1
            dict_appear[data] = n
        else:
            dict_num[data] += 1
        n += 1
    except:
        break
        
for ele in dict_num:
    dict_order[ele] = -1000*dict_num[ele]+dict_appear[ele]
dict_order = sorted(dict_order.items(), key = lambda x: x[1])
#print(dict_order)
#print(dict_num)
for n, ele in enumerate(dict_order):
    if n==8:
        break
    print(ele[0].split()[0][-16:], ele[0].split()[1], dict_num[ele[0]])

# for i in range(len(l[-8:])):
#     print(l[-8:][i], ll[-8:][i])