n=int(input()) d={} for i in range(n): s,c=input().split() c=int(c) d[s]=c a=[0]*8 for s in d: a[d[s]]+=1 print(*a,sep="\n")