#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
struct Pair {
  int val, id;
  Pair() {}
  Pair(int val, int id) : val(val), id(id) {}
  friend bool operator<(const Pair &A, const Pair &B) { return A.val > B.val; }
};
priority_queue<Pair> Q[3];
int vis[maxn];
int p[maxn];
int a[maxn];
int b[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (int i = 1; i <= n; i++) {
    Q[a[i]].push(Pair(p[i], i));
    Q[b[i]].push(Pair(p[i], i));
  }
  int m;
  scanf("%d", &m);
  while (m--) {
    int c;
    scanf("%d", &c);
    while (!Q[c].empty() && vis[Q[c].top().id]) Q[c].pop();
    if (Q[c].empty())
      printf("-1 ");
    else {
      printf("%d ", Q[c].top().val);
      vis[Q[c].top().id] = 1;
      Q[c].pop();
    }
  }
  return 0;
}
