#include <bits/stdc++.h>
using namespace std;
set<int> price[4];
const int maxN = 200010;
int p[maxN], a[maxN], b[maxN];
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < int(N); i++) cin >> p[i];
  for (int i = 0; i < int(N); i++) cin >> a[i];
  for (int i = 0; i < int(N); i++) cin >> b[i];
  for (int i = 0; i < int(N); i++) {
    price[a[i]].insert(p[i]);
    price[b[i]].insert(p[i]);
  }
  int M;
  cin >> M;
  for (int i = 0; i < int(M); i++) {
    int c;
    cin >> c;
    if (price[c].size() == 0)
      cout << -1 << " ";
    else {
      int precioMasBarato = *(price[c].begin());
      cout << precioMasBarato << " ";
      for (int j = 0; j < int(4); j++) price[j].erase(precioMasBarato);
    }
  }
  cout << endl;
  return 0;
}
