from collections import defaultdict name_color = defaultdict(int) N = int(input()) for _ in range(N): name, color = input().split() name_color[name] = int(color) ans = [0 for _ in range(8)] for c in name_color.values(): ans[c] += 1 for i in ans: print(i)