#include <bits/stdc++.h>
using namespace std;
template <class T>
T sqr(T const &x) {
  return x * x;
}
template <class T>
int sz(T const &x) {
  return static_cast<int>(x.size());
}
template <class A, class B>
auto mp(A const &a, B const &b) -> decltype(make_pair(a, b)) {
  return make_pair(a, b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  void runSolution();
  runSolution();
  return 0;
}
struct T {
  int p;
  int idx;
  T(int p, int idx) : p(p), idx(idx) {}
  friend bool operator>(T const &a, T const &b) { return a.p > b.p; }
};
int n;
vector<int> p;
priority_queue<T, vector<T>, greater<T> > front[3];
priority_queue<T, vector<T>, greater<T> > back[3];
vector<int> del;
T get(priority_queue<T, vector<T>, greater<T> > &q) {
  while (!q.empty()) {
    auto t = q.top();
    if (!del[t.idx]) {
      return t;
    }
    q.pop();
  }
  return T(-1, -1);
}
int solve(int c) {
  T f = get(front[c]);
  T b = get(back[c]);
  if (f.idx == -1 && b.idx == -1) {
    return -1;
  }
  if (f.idx == -1 || (b.idx != -1 && b.p <= f.p)) {
    del[b.idx] = 1;
    return b.p;
  }
  if (b.idx == -1 || (f.idx != -1 && f.p <= b.p)) {
    del[f.idx] = 1;
    return f.p;
  }
  assert(false);
  return -1;
}
void runSolution() {
  cin >> n;
  del.assign(n, 0);
  p.resize(n);
  for (int i = 0; i < int(n); ++i) {
    cin >> p[i];
  }
  for (int i = 0; i < int(n); ++i) {
    int a;
    cin >> a;
    --a;
    front[a].push(T(p[i], i));
  }
  for (int i = 0; i < int(n); ++i) {
    int b;
    cin >> b;
    --b;
    back[b].push(T(p[i], i));
  }
  int m;
  cin >> m;
  for (int i = 0; i < int(m); ++i) {
    int c;
    cin >> c;
    --c;
    cout << solve(c) << " ";
  }
  cout << endl;
}
