#include <bits/stdc++.h>
using namespace std;
int f_abs(int x) { return x < 0 ? -x : x; }
int f_min(int x, int y) { return x < y ? x : y; }
int f_max(int x, int y) { return x > y ? x : y; }
double f_abs(double x) { return x < 0 ? -x : x; }
double f_min(double x, double y) { return x < y ? x : y; }
double f_max(double x, double y) { return x > y ? x : y; }
struct Point {
  double x, y;
  void get() { scanf("%lf%lf", &x, &y); }
  bool friend operator<(Point a, Point b) {
    if (f_abs(a.x - b.x) < 1e-9) return a.y + 1e-9 < b.y;
    return a.x < b.x;
  }
};
struct Line {
  Point s, e;
  void get() {
    s.get();
    e.get();
  }
};
struct Edge {
  int u, v, next;
};
Edge edge[100000];
int head[10000], en;
void insert(int u, int v) {
  edge[en].u = u;
  edge[en].v = v;
  edge[en].next = head[u];
  head[u] = en++;
}
int N;
struct Friend {
  int list[300], loc[300], ans;
  bool mark[300];
  void get() {
    int i;
    for (i = 0; i < N; i++) {
      scanf("%d", &list[i]);
      list[i]--;
      loc[list[i]] = i;
    }
  }
};
Friend sel, fri[300];
void get_data() {
  scanf("%d", &N);
  int i;
  for (i = 0; i < N; i++) fri[i].get();
  sel.get();
  memset(sel.mark, 0, sizeof(sel.mark));
}
void run() {
  int i, j, best, ni, rec;
  for (i = 0; i < N; i++) {
    ni = -1;
    best = -1;
    for (j = 0; j < N; j++) {
      if (j == i) continue;
      if (ni == -1 || sel.loc[ni] > sel.loc[j]) {
        ni = j;
      }
      if (ni == i) continue;
      if (best == -1 || fri[i].loc[ni] < fri[i].loc[best]) {
        best = ni;
        rec = j;
      }
    }
    fri[i].ans = rec;
  }
  for (i = 0; i < N; i++) {
    printf("%d", fri[i].ans + 1);
    if (i == N - 1)
      printf("\n");
    else
      printf(" ");
  }
}
int main() {
  get_data();
  run();
  return 0;
}
