#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
vector<long long> price(vector<long long> &p, vector<long long> &a,
                        vector<long long> &b, vector<long long> &c) {
  vector<long long> res;
  set<long long> s[3];
  for (long long i = 0; i < b.size(); i++) {
    s[b[i] - 1].insert(p[i]);
  }
  for (long long i = 0; i < a.size(); i++) {
    s[a[i] - 1].insert(p[i]);
  }
  for (long long i = 0; i < c.size(); i++) {
    if (s[c[i] - 1].empty()) {
      res.push_back(-1);
    } else {
      auto pr = (s[c[i] - 1].begin());
      res.push_back(*pr);
      auto it = s[c[i] % 3].find(*pr);
      if (it != s[c[i] % 3].end()) {
        s[c[i] % 3].erase(it);
      }
      auto it1 = s[(c[i] + 1) % 3].find(*pr);
      if (it1 != s[(c[i] + 1) % 3].end()) {
        s[(c[i] + 1) % 3].erase(it1);
      }
      s[c[i] - 1].erase(pr);
    }
  }
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  vector<long long> p(n), a(n), b(n);
  for (long long i = 0; i < n; i++) cin >> p[i];
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) cin >> b[i];
  long long m;
  cin >> m;
  vector<long long> c(m);
  for (long long i = 0; i < m; i++) cin >> c[i];
  for (auto it : price(p, a, b, c)) cout << it << " ";
  cout << endl;
  return 0;
}
