#include <bits/stdc++.h>
using namespace std;
struct item {
  int price, frnt, bck;
};
item a[200001];
bool cmp(item x, item y) {
  if (x.price < y.price)
    return true;
  else
    return false;
}
queue<int> one, two, three;
int main() {
  int n, m, i, ch, c;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &a[i].price);
  for (i = 0; i < n; i++) scanf("%d", &a[i].frnt);
  for (i = 0; i < n; i++) scanf("%d", &a[i].bck);
  sort(a, a + n, cmp);
  for (i = 0; i < n; i++) {
    if (a[i].frnt == 1 || a[i].bck == 1) one.push(i);
    if (a[i].frnt == 2 || a[i].bck == 2) two.push(i);
    if (a[i].frnt == 3 || a[i].bck == 3) three.push(i);
  }
  scanf("%d", &m);
  for (i = 0; i < m; i++) {
    ch = 200010;
    scanf("%d", &c);
    if (c == 1) {
      while (!one.empty()) {
        ch = one.front();
        if (a[ch].price == 0)
          one.pop();
        else {
          one.pop();
          break;
        }
      }
      if (a[ch].price == 0 || ch == 200010)
        printf("-1 ");
      else
        printf("%d ", a[ch].price);
      a[ch].price = 0;
    } else if (c == 2) {
      while (!two.empty()) {
        ch = two.front();
        if (a[ch].price == 0)
          two.pop();
        else {
          two.pop();
          break;
        }
      }
      if (a[ch].price == 0 || ch == 200010)
        printf("-1 ");
      else
        printf("%d ", a[ch].price);
      a[ch].price = 0;
    } else if (c == 3) {
      while (!three.empty()) {
        ch = three.front();
        if (a[ch].price == 0)
          three.pop();
        else {
          three.pop();
          break;
        }
      }
      if (a[ch].price == 0 || ch == 200010)
        printf("-1 ");
      else
        printf("%d ", a[ch].price);
      a[ch].price = 0;
    }
  }
  return 0;
}
