#include <bits/stdc++.h>
using namespace std;
const double _pi = acos(-1.0);
int ar[5];
int main() {
  int n;
  scanf("%d", &n);
  vector<pair<int, pair<int, int> > > v(n);
  for (int i = 0; i < n; i++) scanf("%d", &v[i].first);
  for (int i = 0; i < n; i++) scanf("%d", &v[i].second.first);
  for (int i = 0; i < n; i++) scanf("%d", &v[i].second.second);
  sort(v.begin(), v.end());
  ar[1] = -1;
  ar[2] = -1;
  ar[3] = -1;
  for (int i = 0; i < n; i++) {
    if (ar[v[i].second.first] == -1) ar[v[i].second.first] = i;
    if (ar[v[i].second.second] == -1) ar[v[i].second.second] = i;
  }
  int m;
  scanf("%d", &m);
  while (m--) {
    int c, res = -1;
    scanf("%d", &c);
    if (ar[c] != -1) {
      res = v[ar[c]].first;
      if (res == -1) {
        int k = ar[c] + 1;
        ar[c] = -1;
        for (int j = k; j < n; j++) {
          if (v[j].first != -1 &&
              (v[j].second.first == c || v[j].second.second == c)) {
            ar[c] = j;
            res = v[ar[c]].first;
            v[ar[c]].first = -1;
            break;
          }
        }
      } else
        v[ar[c]].first = -1;
    }
    if (m > 0)
      printf("%d ", res);
    else
      printf("%d\n", res);
  }
  return 0;
}
