#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int ip[5];
int g[maxn];
map<int, int> q;
struct node {
  int idx;
  int price;
};
vector<node> color[5];
struct clo {
  int idx;
  int p, a, b;
} a[maxn];
bool vis[maxn];
int cmp(clo& a, clo& b) { return a.p < b.p; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i].p;
    a[i].idx = i;
  }
  for (int i = 0; i < n; i++) cin >> a[i].a;
  for (int i = 0; i < n; i++) cin >> a[i].b;
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) cin >> g[i];
  sort(a, a + n, cmp);
  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= 3; j++) {
      if (a[i].a == j || a[i].b == j)
        color[j].push_back(node{a[i].idx, a[i].p});
    }
  }
  for (int i = 0; i < m; i++) {
    int f = g[i];
    while (ip[f] < color[f].size() && vis[color[f][ip[f]].idx]) ip[f]++;
    if (ip[f] == color[f].size()) {
      cout << -1 << endl;
      continue;
    }
    cout << color[f][ip[f]].price << ' ';
    vis[color[f][ip[f]++].idx] = 1;
  }
  cout << endl;
  return 0;
}
