#include<iostream>
using namespace std;
int f[33], p[10];
int main()
{
int n, m, sum = 0;
cin >> n;
for(int i = 1; i <= 7; i++)
{
cin >> m;
f[m] = 1;//将相应号码数记为 1
}
for(int i = 1; i <= n; i++)
{
for(int j = 1; j <= 7; j++)
{
cin >> m;
if(f[m] == 1)
sum++;
}
p[7 - sum]++;
}
for(int i = 0; i < 7; i++)
{
cout << p[i] << ' ';
}
return 0;
}