#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vs = vector<string>;
using pll = pair<ll, ll>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;
typedef struct Shirt {
  int price, a, b;
} shirt;
using pii = pair<int, int>;
using ppii = pair<int, pii>;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<shirt> asdf(n);
  for (ll a = (0); a < (n); a++) {
    cin >> asdf[a].price;
  }
  for (ll a = (0); a < (n); a++) {
    cin >> asdf[a].a;
  }
  for (ll a = (0); a < (n); a++) {
    cin >> asdf[a].b;
  }
  set<ppii> shirts;
  for (ll a = (0); a < (n); a++) {
    shirts.insert({asdf[a].price, {asdf[a].a, asdf[a].b}});
  }
  int m;
  cin >> m;
  vector<set<ppii>::iterator> its(4, shirts.begin());
  for (ll a = (0); a < (m); a++) {
    int col;
    cin >> col;
    bool happ = false;
    while (its[col] != shirts.end()) {
      if (its[col]->second.first == col || its[col]->second.second == col) {
        cout << its[col]->first << ' ';
        its[0] = its[col];
        for (ll b = (1); b < (4); b++) {
          if (its[b] == its[0]) {
            its[b]++;
          }
        }
        shirts.erase(its[0]);
        happ = true;
        break;
      }
      if (!happ) {
        its[col]++;
      }
    }
    if (!happ) {
      cout << "-1 ";
    }
  }
  cout << '\n';
}
