#include <bits/stdc++.h>
using namespace std;
const int maxn = 300 + 10;
const int INF = 0x3f3f3f3f;
int A[maxn][maxn];
int n;
int res[maxn];
bool cant[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n + 1; ++i)
    for (int j = 1; j <= n; ++j) scanf("%d", &A[i][j]);
  for (int i = 1; i <= n; ++i) {
    memset(cant, 0, sizeof(cant));
    int Min = INF;
    for (int j = 1; j <= n; ++j) {
      if (Min < A[n + 1][j]) cant[A[n + 1][j]] = 1;
      if (A[n + 1][j] != i) Min = min(Min, A[n + 1][j]);
    }
    for (int j = 1; j <= n; ++j)
      if (!cant[A[i][j]] && A[i][j] != i) {
        res[i] = A[i][j];
        break;
      }
  }
  for (int i = 1; i <= n; ++i) printf("%d%c", res[i], " \n"[i == n]);
  return 0;
}
