#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2e5 + 1;
bool bought[MAX_N];
struct shirt {
  int p;
  int fc, bc;
  int idx;
  shirt() { p = 0, fc = 0, bc = 0, idx = 0; };
};
struct shirt_comp {
  bool operator()(const shirt &a, const shirt &b) { return a.p < b.p; }
};
void solve() {
  int n;
  cin >> n;
  vector<shirt> shirts(n);
  map<int, set<shirt, shirt_comp> > m;
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    shirts[i].p = p;
    shirts[i].idx = i;
  }
  for (int i = 0; i < n; i++) {
    int fc;
    cin >> fc;
    shirts[i].fc = fc;
    m[fc].insert(shirts[i]);
  }
  for (int i = 0; i < n; i++) {
    int bc;
    cin >> bc;
    shirts[i].bc = bc;
    m[bc].insert(shirts[i]);
  }
  int k;
  cin >> k;
  for (int i = 0; i < k; i++) {
    int color;
    cin >> color;
    bool found = false;
    while (!m[color].empty()) {
      shirt cur = *m[color].begin();
      m[color].erase(m[color].begin());
      if (!bought[cur.idx]) {
        found = true;
        bought[cur.idx] = true;
        cout << cur.p << ' ';
        break;
      }
    }
    if (!found) {
      cout << -1 << ' ';
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
