#include <bits/stdc++.h>
using namespace std;
int n, m;
pair<long long, int> p[200005];
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < (n); i++) {
    cin >> p[i].first;
    p[i].second = i;
  }
  priority_queue<pair<long long, int>, vector<pair<long long, int> >,
                 greater<pair<long long, int> > >
      que[3];
  for (int cnt = 0; cnt < (2); cnt++) {
    for (int i = 0; i < (n); i++) {
      int a;
      cin >> a;
      a--;
      que[a].push(p[i]);
    }
  }
  bool used[n];
  fill(used, used + n, false);
  cin >> m;
  for (int i = 0; i < (m); i++) {
    int c;
    cin >> c;
    c--;
    while (!que[c].empty() && used[que[c].top().second]) que[c].pop();
    if (que[c].empty())
      cout << -1;
    else {
      cout << que[c].top().first;
      used[que[c].top().second] = true;
      que[c].pop();
    }
    if (i < m - 1)
      cout << " ";
    else
      cout << endl;
  }
  return 0;
}
