#include<bits/stdc++.h>
using namespace std;
int main() {
int n;//彩票数
int arry_right[7];//中奖号码
int arry_buy[1000][7];//买的号码
int answer[7] = {0};//最终中奖的彩票数
int ans = 0;
cin >> n;
for (int i = 0; i < 7; i++) {
cin >> arry_right[i];
}
for (int i = 0; i < n; i++) {//几张票循环几次
ans = 0;//每次ans清零
for (int j = 0; j < 7; j++) {//每张票七个数字
cin >> arry_buy[i][j];
for (int k = 0; k < 7; k++) {//分别和中奖数字对比
if (arry_buy[i][j] == arry_right[k])
ans++;
}
}
answer[7 - ans]++;//看ans和answer[]下标的关系
}
for (int i = 0; i<7; i++) {
cout << answer[i] << " ";
}
cout << endl;
system("pause");
return 0;
}