#include <bits/stdc++.h>
long long int MOD = 1000000007;
using namespace std;
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
bool sortbysec(const pair<long long int, long long int> &a,
               const pair<long long int, long long int> &b) {
  return (a.second < b.second);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long int t;
  t = 1;
  while (t--) {
    long long int n, b, m, c, x;
    cin >> n;
    vector<pair<long long int, pair<long long int, long long int> > > a(n);
    for (long long int i = 0; i < n; i++) {
      cin >> a[i].first;
    }
    for (long long int i = 0; i < n; i++) {
      cin >> a[i].second.first;
    }
    for (long long int i = 0; i < n; i++) {
      cin >> a[i].second.second;
    }
    map<long long int, long long int> M1, M2, M3;
    for (auto &i : a) {
      if (i.second.first == 1) {
        M1[i.first] = 1;
      } else if (i.second.first == 2) {
        M2[i.first] = 1;
      } else if (i.second.first == 3) {
        M3[i.first] = 1;
      }
      if (i.second.second == 1) {
        M1[i.first] = 1;
      } else if (i.second.second == 2) {
        M2[i.first] = 1;
      } else if (i.second.second == 3) {
        M3[i.first] = 1;
      }
    }
    cin >> m;
    for (long long int i = 0; i < m; i++) {
      cin >> c;
      if (c == 1 && !M1.empty()) {
        b = M1.begin()->first;
        cout << b << " ";
      } else if (c == 2 && !M2.empty()) {
        b = M2.begin()->first;
        cout << b << " ";
      } else if (c == 3 && !M3.empty()) {
        b = M3.begin()->first;
        cout << b << " ";
      } else {
        cout << -1 << " ";
      }
      M1.erase(b);
      M2.erase(b);
      M3.erase(b);
    }
    return 0;
  }
}
