#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long p[n];
  for (long long i = 0; i < n; i++) {
    cin >> p[i];
  }
  set<pair<long long, long long>> x[4];
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    x[a].insert({p[i], i});
  }
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    x[a].insert({p[i], i});
  }
  long long m;
  cin >> m;
  while (m--) {
    long long c;
    cin >> c;
    if (x[c].empty()) {
      cout << -1 << " ";
      continue;
    }
    pair<long long, long long> curr = (*x[c].begin());
    cout << curr.first << " ";
    x[1].erase(curr);
    x[2].erase(curr);
    x[3].erase(curr);
  }
  cout << endl;
  return 0;
}
