#include <bits/stdc++.h>
using namespace std;
multiset<int> s[3];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(10);
  int n;
  while (cin >> n) {
    vector<int> p(n), a(n), b(n);
    map<int, int> l;
    int ptr = 0;
    for (auto &i : p) {
      cin >> i;
      l[i] = ptr++;
    }
    for (auto &i : a) cin >> i, --i;
    for (auto &i : b) cin >> i, --i;
    for (int i = 0; i < n; ++i) {
      s[a[i]].insert(p[i]);
      s[b[i]].insert(p[i]);
    }
    int m;
    cin >> m;
    while (m--) {
      int c;
      cin >> c;
      --c;
      if (s[c].size()) {
        int price = *s[c].begin();
        s[a[l[price]]].erase(s[a[l[price]]].find(price));
        s[b[l[price]]].erase(s[b[l[price]]].find(price));
        cout << price << ' ';
      } else {
        cout << -1 << ' ';
      }
    }
    cout << '\n';
  }
}
