#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n;
  long long int p[n], a[n], b[n];
  for (long long int i = 0; i < n; i++) cin >> p[i];
  for (long long int i = 0; i < n; i++) cin >> a[i];
  for (long long int i = 0; i < n; i++) cin >> b[i];
  set<pair<long long int, long long int> > t[4];
  for (long long int i = 0; i < n; i++)
    for (int j = 1; j <= 3; j++) {
      if (a[i] == j || b[i] == j) t[j].insert(make_pair(p[i], i));
    }
  set<pair<long long int, long long int> >::iterator it;
  vector<long long int> ans;
  cin >> m;
  for (long long int i = 0; i < m; i++) {
    int x;
    cin >> x;
    if (t[x].size() == 0) {
      ans.push_back(-1);
    } else {
      it = t[x].begin();
      int id = (*it).second;
      ans.push_back((*it).first);
      for (int j = 1; j <= 3; j++) {
        if (a[id] == j || b[id] == j)
          t[j].erase(make_pair((*it).first, (*it).second));
      }
    }
  }
  vector<long long int>::iterator t1;
  for (long long int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  return 0;
}
