n = int(input()) list = [0, 0, 0, 0, 0, 0, 0, 0] list1 = [] list2 = [] size = 0 for _ in range(n): s, cc = input().split() c = int(cc) fin = 0 for i in range(size): if s == list1[i]: list[list2[i]] -= 1 list2[i] = c fin = 1 if fin == 0: list1 = list1 + [s] list2 = list2 + [c] size += 1 list[c] += 1 for i in range(8): print(list[i])