#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long double PI = acos(-1);
const int N = 1e5 + 10;
const int MOD = 1e9 + 7;
const int mod1 = 998244353;
const long long INF = 2e18;
set<int> lol[5];
map<int, int> mp;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cerr.tie(nullptr);
  {
    int n, k;
    cin >> n;
    for (int i = 1; i <= n; i++) {
      int z;
      cin >> z;
      mp[i] = z;
    }
    for (int i = 1; i <= n; i++) {
      int z;
      cin >> z;
      lol[z].insert(mp[i]);
    }
    for (int i = 1; i <= n; i++) {
      int z;
      cin >> z;
      lol[z].insert(mp[i]);
    }
    cin >> k;
    while (k--) {
      int z;
      cin >> z;
      if (!lol[z].empty()) {
        auto it = lol[z].begin();
        int zzz = *it;
        cout << zzz << " ";
        lol[1].erase(zzz);
        lol[2].erase(zzz);
        lol[3].erase(zzz);
      } else {
        cout << -1 << " ";
      }
    }
  }
  return EXIT_SUCCESS;
}
