dic = {}
while True:
    try:
        s = input().split('\\')[-1]
        s = s.split()[0][-16:] + ' ' + s.split()[1]
        dic[s] = dic.get(s, 0) + 1
    except:
        break

for i in list(dic.keys())[-8:]:
    print(i, end=' ')
    print(dic[i])