n=int(input())
p=0
s1=[int(i) for i in input().split()]
x0,x1,x2,x3,x4,x5,x6=0,0,0,0,0,0,0
for i in range(n):
s2=list(map(int,input().split()))
s3=s1
for j in range(7):
if s2[j] in s3: s3.remove(s2[j]);p+=1
if p==1:x6+=1
elif p==2:x5+=1
elif p == 3:x4 += 1
elif p == 4: x3 += 1
elif p == 5: x2 += 1
elif p == 6: x1 += 1
elif p == 7:x0 += 1
p=0
print(x0,x1,x2,x3,x4,x5,x6)