k = {1: 0, 2: 1, 3: 2, 4: 3, 5: 4, 6: 5, 7: 6, 8: 7} n = int(input()) for i in range(n): name, c = map(str, input().split()) k[name] = int(c) for i in range(8): print(list(k.values()).count(i) - 1)