#include <bits/stdc++.h>
using namespace std;
const int MAX = 500010;
int n, m;
struct node {
  int id;
  int val;
  int x, y;
  bool operator<(const node &a) const { return a.val < val; }
} d[MAX];
int vis[MAX];
priority_queue<node> q[4];
int main() {
  int t, i, j;
  while (~scanf("%d", &n)) {
    while (!q[1].empty()) q[1].pop();
    while (!q[2].empty()) q[2].pop();
    while (!q[3].empty()) q[3].pop();
    memset(vis, 0, sizeof(vis));
    for (i = 0; i < n; i++) {
      scanf("%d", &d[i].val);
      d[i].id = i;
    }
    for (i = 0; i < n; i++) scanf("%d", &d[i].x);
    for (i = 0; i < n; i++) scanf("%d", &d[i].y);
    for (i = 0; i < n; i++) {
      if (d[i].x != d[i].y) {
        q[d[i].x].push(d[i]);
        q[d[i].y].push(d[i]);
      } else
        q[d[i].x].push(d[i]);
    }
    scanf("%d", &m);
    for (i = 0; i < m; i++) {
      int a;
      scanf("%d", &a);
      node now;
      if (!q[a].empty()) {
        now = q[a].top();
        q[a].pop();
        printf("%d ", now.val);
        vis[now.id] = 1;
      } else
        printf("-1 ");
      for (j = 1; j <= 3; j++) {
        while (1) {
          if (q[j].empty()) break;
          if (vis[q[j].top().id] == 1)
            q[j].pop();
          else
            break;
        }
      }
    }
  }
  return 0;
}
