#include <bits/stdc++.h>
using namespace std;
int ps[512][512];
bool pass[512];
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i <= N; i++)
    for (int j = 0; j < N; j++) scanf("%d", &ps[i][j]);
  for (int i = 0; i < N; i++) {
    if (i) printf(" ");
    for (int j = 0; j < N; j++)
      if (ps[i][j] != i + 1) {
        bool check = true;
        for (int k = 0; ps[N][k] != ps[i][j]; k++)
          if (ps[N][k] != i + 1 && ps[N][k] < ps[i][j]) {
            check = false;
            break;
          }
        if (check) {
          printf("%d", ps[i][j]);
          break;
        }
      }
  }
  printf("\n");
  return 0;
}
