from collections import Counter N = int(input().strip()) dic = {} for i in range(N): S, C = input().strip().split(' ') dic[S] = int(C) c = Counter(list(dic.values())) for i in range(8): print(c[i])