#include <bits/stdc++.h>
using namespace std;
const int N = 305;
int n;
int x[N][N];
int y[N];
int r[N];
int have[N], pos[N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      scanf("%d", &x[i][j]);
      x[i][j]--;
    }
  for (int i = 0; i < n; i++) {
    scanf("%d", &y[i]);
    y[i]--;
    pos[y[i]] = i;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++)
      if (x[i][j] != i) {
        int ok = 1;
        for (int jp = 0; jp < x[i][j]; jp++)
          if (jp != i) {
            if (pos[jp] < pos[x[i][j]]) {
              ok = 0;
              break;
            }
          }
        if (ok) {
          r[i] = x[i][j];
          break;
        }
      }
  }
  for (int i = 0; i < n; i++) printf("%d ", r[i] + 1);
  printf("\n");
}
