#include <bits/stdc++.h>
using namespace std;
long long N, M, P[300100], A[300100], B[300100];
multiset<pair<long long, pair<long long, long long> > > F[3];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N;
  for (int i = 0; i < N; i++) cin >> P[i];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    A[i]--;
  }
  for (int i = 0; i < N; i++) {
    cin >> B[i];
    B[i]--;
    F[A[i]].insert({P[i], {A[i], B[i]}});
    F[B[i]].insert({P[i], {A[i], B[i]}});
  }
  cin >> M;
  for (int c; M--;) {
    cin >> c;
    c--;
    if (F[c].empty())
      cout << -1 << '\n';
    else {
      pair<long long, pair<long long, long long> > p = *(F[c].begin());
      F[c].erase(F[c].begin());
      int idx = p.second.first ^ p.second.second ^ c;
      F[idx].erase(F[idx].find(p));
      cout << p.first << '\n';
    }
  }
}
