import sys
import os
error_list = []
row_list = []
count = []
completed_error_list = []
for line in sys.stdin:
line = line.replace("\n", "")
sp = line.split(" ")
path = sp[0]
row = sp[1]
dirStr, ext = os.path.splitext(path)
file = dirStr.split("\\")[-1]
if len(file) > 16:
file = file[len(file) - 16:]
if file + " " + row not in completed_error_list:
error_list.append(file)
row_list.append(row)
completed_error_list.append(file + " " + row)
if len(error_list) <= 8:
for i in range(len(error_list)):
print(error_list[i],end=" ")
print(row_list[i],end=" ")
print(completed_error_list.count(error_list[i] + " " + row_list[i]))
else:
for i in range(len(error_list)):
if i < 8:
count = len(error_list) - 8 + i
if len(error_list) - i >= 0:
print(error_list[count],end=" ")
print(row_list[count],end=" ")
print(completed_error_list.count(error_list[count] + " " + row_list[count]))