#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<vector<bool>> inf(100, vector<bool>(10, false));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 10; j++) {
      int F;
      cin >> F;
      if (F == 1) {
        inf[i][j] = true;
      }
    }
  }
  vector<vector<int>> benefit(N, vector<int>(N));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      int P;
      cin >> P;
      benefit[i][j] = P;
    }
  }
}
