#include <bits/stdc++.h>
using namespace std;
int a[301][301];
int b[301];
int c[301];
int main() {
  int n;
  cin >> n;
  int i, j, k;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) {
      cin >> a[i][j];
    }
  for (i = 1; i <= n; i++) cin >> b[i];
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (a[i][j] != i) {
        for (k = 1; k <= n; k++) {
          if (b[k] < a[i][j] && b[k] != i) break;
          if (b[k] == a[i][j]) break;
        }
        if (b[k] == a[i][j]) break;
      }
    }
    c[i] = a[i][j];
  }
  for (i = 1; i <= n; i++) cout << c[i] << " ";
  cout << endl;
  return 0;
}
