#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, m, price[N];
struct cmp {
  bool operator()(int a, int b) { return price[a] < price[b]; }
};
set<int, cmp> a[3];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &price[i]);
  for (int i = 0, x; i < n; i++) {
    scanf("%d", &x);
    x--;
    a[x].insert(i);
  }
  for (int i = 0, x; i < n; i++) {
    scanf("%d", &x);
    x--;
    a[x].insert(i);
  }
  scanf("%d", &m);
  while (m--) {
    int x;
    scanf("%d", &x);
    x--;
    if (a[x].empty())
      printf("%d ", -1);
    else {
      int p = *a[x].begin();
      printf("%d ", price[p]);
      for (int i = 0; i < 3; i++) a[i].erase(p);
    }
  }
  return 0;
}
