#include <bits/stdc++.h>
using namespace std;
struct node {
  int a, b, p, num;
  friend bool operator<(node a, node b) { return a.p > b.p; }
} s[200005];
int book[200005];
int n, m;
priority_queue<node> q[5];
int main() {
  cin >> n;
  memset(book, 0, sizeof(book));
  for (int i = 1; i <= n; i++) scanf("%d", &s[i].p);
  for (int i = 1; i <= n; i++) scanf("%d", &s[i].a);
  for (int i = 1; i <= n; i++) scanf("%d", &s[i].b);
  for (int i = 1; i <= n; i++) {
    s[i].num = i;
    q[s[i].a].push(s[i]);
    if (s[i].a != s[i].b) q[s[i].b].push(s[i]);
  }
  cin >> m;
  int k;
  node tmp;
  for (int i = 0; i < m; i++) {
    scanf("%d", &k);
    if (q[k].empty()) {
      cout << -1 << " ";
      continue;
    }
    while (!q[k].empty()) {
      tmp = q[k].top();
      q[k].pop();
      if (book[tmp.num]) {
        if (q[k].empty()) cout << -1 << " ";
        continue;
      }
      book[tmp.num] = 1;
      cout << tmp.p << " ";
      break;
    }
  }
  cout << endl;
  return 0;
}
