#include <bits/stdc++.h>
using namespace std;
void afify() {
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const long long oo = (long long)10e9 + 7;
const double EPS = 1e-4;
int main() {
  afify();
  int n;
  cin >> n;
  map<long long, long long> mp;
  vector<long long> o;
  vector<long long> t;
  vector<long long> th;
  vector<long long> pr;
  for (int i = int(0); i < n; i++) {
    int x;
    cin >> x;
    pr.push_back(x);
  }
  for (int i = int(0); i < n; i++) {
    int x;
    cin >> x;
    if (x == 1) {
      o.push_back(pr[i]);
      mp[pr[i]] = 1;
    }
    if (x == 2) {
      t.push_back(pr[i]);
      mp[pr[i]] = 1;
    }
    if (x == 3) {
      th.push_back(pr[i]);
      mp[pr[i]] = 1;
    }
  }
  for (int i = int(0); i < n; i++) {
    int x;
    cin >> x;
    if (x == 1) {
      o.push_back(pr[i]);
      mp[pr[i]] = 1;
    }
    if (x == 2) {
      t.push_back(pr[i]);
      mp[pr[i]] = 1;
    }
    if (x == 3) {
      th.push_back(pr[i]);
      mp[pr[i]] = 1;
    }
  }
  sort(o.begin(), o.end());
  sort(t.begin(), t.end());
  sort(th.begin(), th.end());
  int q;
  cin >> q;
  int a = 0, s = 0, d = 0;
  for (int i = int(0); i < q; i++) {
    int x;
    cin >> x;
    if (a < o.size() && x == 1) {
      while (a < o.size() && mp[o[a]] == 0) {
        a++;
      }
      if (a == o.size() || mp[o[a]] == 0) {
        cout << "-1"
             << " ";
        continue;
      }
      cout << o[a] << " ";
      a++;
      mp[o[a - 1]] = 0;
    } else if (s < t.size() && x == 2) {
      while (s < t.size() && mp[t[s]] == 0) {
        s++;
      }
      if (s == t.size() || mp[t[s]] == 0) {
        cout << "-1"
             << " ";
        continue;
      }
      cout << t[s] << " ";
      s++;
      mp[t[s - 1]] = 0;
    } else if (d < th.size() && x == 3) {
      while (d < th.size() && mp[th[d]] == 0) {
        d++;
      }
      if (d == th.size() || mp[th[d]] == 0) {
        cout << "-1"
             << " ";
        continue;
      }
      cout << th[d] << " ";
      d++;
      mp[th[d - 1]] = 0;
    } else {
      cout << -1 << endl;
    }
  }
  return 0;
}
