N = int(input()) declarations = [] for i in range(N): INPUT = input().split() S, C = INPUT[0], int(INPUT[1]) declarations.append((S, C)) coder_count = [0] * 8 coder_color = {} for name, color in declarations: if name in coder_color: old_color = coder_color[name] coder_count[old_color] -= 1 coder_color[name] = color coder_count[color] += 1 for i, count in enumerate(coder_count): print(count)