#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
const int N = 200100;
int n, q;
set<pair<int, int> > p1, p2, p3;
struct tt {
  int p, f, b;
};
tt a[N];
void del(int w, int ind) {
  if (a[ind].f == 1) {
    if (p1.size()) p1.erase({w, ind});
  } else if (a[ind].f == 2) {
    if (p2.size()) p2.erase({w, ind});
  } else {
    if (p3.size()) p3.erase({w, ind});
  }
  if (a[ind].b == 1) {
    if (p1.size()) p1.erase({w, ind});
  } else if (a[ind].b == 2) {
    if (p2.size()) p2.erase({w, ind});
  } else {
    if (p3.size()) p3.erase({w, ind});
  }
  return;
}
int main() {
  scanf("%d", &n);
  int x;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    a[i].p = x;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    a[i].f = x;
    if (x == 1)
      p1.insert({a[i].p, i});
    else if (x == 2)
      p2.insert({a[i].p, i});
    else
      p3.insert({a[i].p, i});
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    a[i].b = x;
    if (x == 1)
      p1.insert({a[i].p, i});
    else if (x == 2)
      p2.insert({a[i].p, i});
    else
      p3.insert({a[i].p, i});
  }
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    scanf("%d", &x);
    if (x == 1) {
      if (!p1.size()) {
        printf("-1%c", (i == q - 1 ? '\n' : ' '));
        continue;
      }
      auto it = p1.begin();
      int w, ind;
      w = (*it).first;
      ind = (*it).second;
      printf("%d%c", w, (i == q - 1 ? '\n' : ' '));
      del(w, ind);
    } else if (x == 2) {
      if (!p2.size()) {
        printf("-1%c", (i == q - 1 ? '\n' : ' '));
        continue;
      }
      auto it = p2.begin();
      int w, ind;
      w = (*it).first;
      ind = (*it).second;
      printf("%d%c", w, (i == q - 1 ? '\n' : ' '));
      del(w, ind);
    } else {
      if (!p3.size()) {
        printf("-1%c", (i == q - 1 ? '\n' : ' '));
        continue;
      }
      auto it = p3.begin();
      int w, ind;
      w = (*it).first;
      ind = (*it).second;
      printf("%d%c", w, (i == q - 1 ? '\n' : ' '));
      del(w, ind);
    }
  }
  return 0;
}
