#include <bits/stdc++.h>
using namespace std;
struct Node {
  int p, fr, ba, id;
  bool operator<(const Node &a) const { return p > a.p; }
} cl[200005];
int n, m, op;
bool vis[200005];
priority_queue<Node> q[3];
inline int read() {
  int sum = 0;
  bool m = false;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') m = true;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    sum = (sum << 1) + (sum << 3) + (c ^ 48);
    c = getchar();
  }
  if (m) sum = -sum;
  return sum;
}
inline void write(int x) {
  static int sta[35];
  int top = 0;
  do {
    sta[top++] = x % 10, x /= 10;
  } while (x);
  while (top) putchar(sta[--top] + '0');
}
int main() {
  n = read();
  for (int i = 0; i < n; i++) scanf("%d", &cl[i].p);
  for (int i = 0; i < n; i++) scanf("%d", &cl[i].fr), cl[i].fr--;
  for (int i = 0; i < n; i++) scanf("%d", &cl[i].ba), cl[i].ba--;
  for (int i = 0; i < n; i++) {
    cl[i].id = i;
    if (cl[i].fr == cl[i].ba) {
      q[cl[i].fr].push(cl[i]);
      continue;
    }
    q[cl[i].fr].push(cl[i]);
    q[cl[i].ba].push(cl[i]);
  }
  m = read();
  while (m--) {
    op = read();
    op--;
    bool flag = 0;
    while (!q[op].empty()) {
      Node tmp = q[op].top();
      if (vis[tmp.id])
        q[op].pop();
      else {
        write(tmp.p), putchar(' '), flag = 1;
        vis[tmp.id] = 1;
        q[op].pop();
        break;
      }
    }
    if (!flag) printf("-1 ");
  }
  return 0;
}
