#主要是要理解"循环记录时,只以第一次出现的顺序为准,后面重复的不会更新它的出现时间,仍以第一次为准"
#就算最后一个出现的,也可能因为重复出现被顶掉
s_list = []
dic = {}
while True:
    try:
        path, line = input().split()
        #就算没有16个字符,字符串[-16]也不会报错,自动取第一个
        a = (path.split('\\')[-1][-16:], line)
        if a not in s_list:
            s_list.append(a)
            dic[a] = 1
        else:
            dic[a] += 1
    except:
        break
#就算没有8个元素,数组[-8]也不会报错,自动取第一个
for i in s_list[-8:]:
    print(i[0], i[1],dic[i])





# import sys
# #先处理好输入记录,存在s_list
# s_list = []
# while True:
#     try:
#         s_l = input().split('\\')
#         s = s_l[len(s_l) - 1]
#         path = s.split(' ')[0]
#         line = s.split(' ')[1]
#         if len(path) > 16:
#             path = path[len(path) - 16:]
#             s = path + " " + line
#         s_list.append(s)
#     except:
# #         print(sys.exc_info())
#         break

# #计算重复次数
# dic = {}
# to_dele = []
# s_len = len(s_list)
# for i in range(s_len):
#     s = s_list[i]
#     if s in dic:
#         dic[s] += 1
#         to_dele.append(i)
#     else:
#         dic[s] = 1

# #第二次出现的,删掉
# while len(to_dele) > 0:
# #     print(to_dele[-1])
#     del s_list[to_dele[-1]]
#     del to_dele[-1]
# # print(s_list)

#  #最多输出8个
# startIndex = 0
# if len(s_list) > 8:
#     startIndex = len(s_list) - 8
# for i in range(startIndex, len(s_list)):
#     s = s_list[i]
#     s = s + " " + str(dic[s])
#     print(s)



# # dic = {}
# # s_len = len(s_list)
# # index = s_len
# # while index > 0:
# #     index -= 1
# #     s = s_list[index]
# #     if s in dic:
# #         dic[s] += 1
# #     else:
# #         dic[s] = 1
# #     if len(dic) >= 8:
# #         break

# # print_set = set()
# # for i in range(index, s_len):
# #     s = s_list[i]
# #     s = s + " " + str(dic[s])
# #     if s not in print_set:
# #         print(s)
# #         print_set.add(s)