_ = input() ss = {} cs = {} while True: try: S, C = input().split() ss[S] = int(C) except EOFError: break for s, c in ss.items(): cs.setdefault(c, 0) cs[c] += 1 for c in range(8): if c in cs: print(cs[c]) else: print(0)