from collections import defaultdict
import sys

d = defaultdict(int)
# 循环记录,只输出最后出现的八条错误记录
record = []

for line in sys.stdin:
    line = line.strip().split(" ")
    filename = line[0]
    # 只记录文件的最后有效16个字符
    filename = filename[filename.rfind('\\')+1:][-16:] + " " + line[1]
    d[filename] += 1
    if filename not in record:
        record.append(filename)

for i in range(len(record)-8, len(record), 1):
    # 只输出最后出现的八条记录,有可能少于八条
    if i >= 0:
        print("{} {}".format(record[i], d[record[i]]))