#include <bits/stdc++.h>
using namespace std;
const long long maxN = 2e5 + 12;
const long long INF = 1e18 + 12;
const long long Inf = 1e9 + 12;
const long long mod = 1e9 + 7;
long long n, m, p[maxN], a[maxN], b[maxN];
set<pair<long long, long long> > s[4];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    s[a[i]].insert({p[i], i});
  }
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
    s[b[i]].insert({p[i], i});
  }
  cin >> m;
  while (m--) {
    long long x;
    cin >> x;
    if (!s[x].size())
      cout << -1 << ' ';
    else {
      pair<long long, long long> P = *(s[x].begin());
      cout << P.first << ' ';
      s[b[P.second]].erase(P);
      s[a[P.second]].erase(P);
    }
  }
}
