#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, set<int> > mp;
  int p[n];
  int a[n];
  int b[n];
  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] == b[i]) {
      mp[a[i]].insert(p[i]);
      continue;
    }
    mp[a[i]].insert(p[i]);
    mp[b[i]].insert(p[i]);
  }
  int m;
  cin >> m;
  int x[m];
  for (int i = 0; i < m; i++) {
    cin >> x[i];
  }
  for (int i = 0; i < m; i++) {
    if (mp[x[i]].size() == 0)
      cout << -1 << " ";
    else {
      int q = *mp[x[i]].begin();
      cout << q << " ";
      for (int j = 1; j <= 3; j++) {
        if (mp[j].find(q) != mp[j].end()) mp[j].erase(mp[j].find(q));
      }
    }
  }
  return 0;
}
