#include <bits/stdc++.h>
using namespace std;
const int dx[9] = {0, 1, -1, 0, 0, -1, -1, 1, 1};
const int dy[9] = {0, 0, 0, -1, 1, -1, 1, -1, 1};
const double pi = acos(-1.0);
const int N = 2e5 + 100;
struct rec {
  long long p, id;
  friend bool operator<(rec a, rec b) {
    return a.p < b.p || (a.p == b.p && a.id < b.id);
  }
};
set<rec> myset[4];
int n, p[N], a[N], b[N];
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> p[i];
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1; i <= n; i++) {
    myset[a[i]].insert(rec{p[i], i});
    if (a[i] != b[i]) myset[b[i]].insert(rec{p[i], i});
  }
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    if (myset[x].empty())
      cout << -1 << endl;
    else {
      __typeof(myset[x].begin()) c = myset[x].begin();
      rec tou = (*c);
      cout << tou.p;
      myset[x].erase(c);
      if (a[tou.id] != b[tou.id]) {
        int t = (x ^ a[tou.id] ^ b[tou.id]);
        c = myset[t].lower_bound(rec{p[tou.id], tou.id});
        myset[x ^ a[tou.id] ^ b[tou.id]].erase(c);
      }
    }
    if (i == n)
      cout << endl;
    else
      cout << ' ';
  }
  return 0;
}
