n=int(input()) takashi=dict() for i in range(n): s,c=input().split() takashi[s]=c counter=dict() for v in takashi.values(): if int(v) not in counter: counter[int(v)]=0 counter[int(v)]+=1 for i in range(8): if i not in counter: print(0) else: print (counter[i])