#include <bits/stdc++.h>
using namespace std;
const char nl = '\n';
inline bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.first == b.first) return a.second < b.second;
  return a.first > b.first;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  return a * b / gcd<T>(a, b);
}
template <class T>
inline T power(T b, T p) {
  long long ans = 1;
  while (p--) ans *= b;
  return ans;
}
void solve() {
  long long n;
  cin >> n;
  long long p[n + 1], a[n], b[n], m, c[n];
  set<long long> s[4];
  for (long long i = 1; i <= n; i++) cin >> p[i];
  long long x;
  for (long long i = 1; i <= n; i++) {
    cin >> x;
    s[x].insert(p[i]);
  }
  for (long long i = 1; i <= n; i++) {
    cin >> x;
    s[x].insert(p[i]);
  }
  cin >> m;
  for (long long i = 1; i <= m; i++) {
    cin >> x;
    if (s[x].size() == 0)
      cout << -1 << endl;
    else {
      long long z = *(s[x].begin());
      cout << z << " ";
      s[1].erase(z);
      s[2].erase(z);
      s[3].erase(z);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
