#include <bits/stdc++.h>
using namespace std;
struct S {
  long long prime;
  int q, h, ji;
};
S xxx[300000];
priority_queue<S> sum[4];
bool biao[300000];
bool operator<(const S &a, const S &b) { return a.prime > b.prime; }
int main() {
  int x, y;
  cin >> x;
  for (int a = 0; a < x; a++) {
    cin >> xxx[a].prime;
    xxx[a].ji = a;
  }
  for (int a = 0; a < x; a++) cin >> xxx[a].q;
  for (int a = 0; a < x; a++) cin >> xxx[a].h;
  for (int a = 0; a < x; a++) {
    sum[xxx[a].q].push(xxx[a]);
    sum[xxx[a].h].push(xxx[a]);
  }
  cin >> y;
  while (y--) {
    cin >> x;
    while (!sum[x].empty() && biao[sum[x].top().ji]) sum[x].pop();
    if (sum[x].empty())
      cout << "-1";
    else {
      cout << sum[x].top().prime;
      biao[sum[x].top().ji] = 1;
      sum[x].pop();
    }
    y == 0 ? cout << endl : cout << " ";
  }
  return 0;
}
