#include <bits/stdc++.h>
using namespace std;
long long int price[200010], a[200010], b[200010];
vector<pair<long long int, int> > v[10];
multiset<pair<long long int, int> > s[5];
int cc[5][5];
int cnt[10];
int ind[11];
int main() {
  int n, m;
  memset(ind, 0, sizeof ind);
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%lld", &price[i]);
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &b[i]);
    cnt[a[i]]++;
    cnt[b[i]]++;
    int x = a[i], y = b[i];
    v[x].push_back({price[i], y});
    v[y].push_back({price[i], x});
    s[x].insert({price[i], y});
    s[y].insert({price[i], x});
  }
  for (int i = 1; i <= 3; i++) sort(v[i].begin(), v[i].end());
  int x, a1 = 0, a2 = 0, a3 = 0;
  cin >> m;
  while (m--) {
    scanf("%d", &x);
    if (cnt[x] == 0) {
      printf("-1 ");
      continue;
    }
    int sz = v[x].size();
    bool f = 0;
    for (int i = ind[x]; i < sz; i++) {
      int xx = v[x][i].second, pr = v[x][i].first;
      ;
      if (cnt[xx] && s[x].count({pr, xx})) {
        ;
        cnt[xx]--;
        printf("%lld ", v[x][i].first);
        s[xx].erase({pr, x});
        s[x].erase({pr, xx});
        f = 1;
        ind[x] = i + 1;
        break;
      }
    }
    if (f) continue;
    printf("-1 ");
  }
}
