#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> p(n);
  vector<int> a(n);
  vector<int> b(n);
  multiset<pair<int, int> > price_1;
  multiset<pair<int, int> > price_2;
  multiset<pair<int, int> > price_3;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == 1 || b[i] == 1) price_1.insert({p[i], i});
    if (a[i] == 2 || b[i] == 2) price_2.insert({p[i], i});
    if (a[i] == 3 || b[i] == 3) price_3.insert({p[i], i});
  }
  int m;
  cin >> m;
  vector<int> fav_color(m);
  for (int i = 0; i < m; i++) {
    cin >> fav_color[i];
  }
  for (int i = 0; i < m; i++) {
    if (fav_color[i] == 1) {
      if (!price_1.empty()) {
        pair<int, int> x = *price_1.begin();
        cout << x.first << " ";
        price_1.erase(x);
        if (price_2.find(x) != price_2.end())
          price_2.erase(x);
        else if (price_3.find(x) != price_3.end())
          price_3.erase(x);
      } else
        cout << "-1 ";
    } else if (fav_color[i] == 2) {
      if (!price_2.empty()) {
        pair<int, int> x = *price_2.begin();
        cout << x.first << " ";
        price_2.erase(x);
        if (price_1.find(x) != price_1.end())
          price_1.erase(x);
        else if (price_3.find(x) != price_3.end())
          price_3.erase(x);
      } else
        cout << "-1 ";
    } else {
      if (!price_3.empty()) {
        pair<int, int> x = *price_3.begin();
        cout << x.first << " ";
        price_3.erase(x);
        if (price_1.find(x) != price_1.end())
          price_1.erase(x);
        else if (price_2.find(x) != price_2.end())
          price_2.erase(x);
      } else
        cout << "-1 ";
    }
  }
  return 0;
}
