#include <bits/stdc++.h>
using namespace std;
int a[310][310], b[310], ans[310];
int main() {
  ios_base::sync_with_stdio(0);
  int n, f;
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> a[i][j];
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1; i <= n; i++) {
    f = 0;
    for (int j = 1; j <= n; j++) {
      if (a[i][j] != i)
        for (int k = 1; i <= n; k++) {
          if (b[k] < a[i][j] && b[k] != i)
            break;
          else if (b[k] == a[i][j]) {
            f = 1;
            break;
          }
        }
      if (f) {
        ans[i] = a[i][j];
        break;
      }
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << "\n";
  return 0;
}
