#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];
bool vis[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});
    myset[b[i]].insert(rec{p[i], i});
  }
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    bool first = false;
    while (!myset[x].empty()) {
      auto y = myset[x].begin();
      rec tou = *y;
      myset[x].erase(y);
      if (vis[tou.id]) continue;
      vis[tou.id] = true;
      first = true;
      cout << tou.p << ' ';
      break;
    }
    if (!first) cout << -1 << ' ';
  }
  return 0;
}
