import collections N = int(input()) D = collections.defaultdict() for _ in range(N): s,c = input().split() D[s]=int(c) C = collections.Counter(D.values()) for i in range(8): print(C[i])