#include using namespace std; int n; int c[34];// c[2]=1 c[3]=1 c[4]=1 c[5]=1 c[6]=1 c[7]=1 c[9]=1 int d[8]; int main() { cin >> n; for (int i = 1; i <= 7; i++) { int x; cin >> x; c[x] = 1; } while (n--) { int cnt = 0; for (int i = 1; i <= 7; i++) { int x; cin >> x; if (c[x]) cnt++; } d[7 - cnt + 1]++; } for (int i = 1; i <= 7; i++) printf("%d ", d[i]); return 0; }