#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, m;
int p[N], a[N], b[N];
int main() {
  scanf("%d", &n);
  set<int> s[3];
  for (int i = 1; i <= n; i++) scanf("%d", p + i);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 1; i <= n; i++) {
    scanf("%d", b + i);
    s[a[i] - 1].insert(p[i]);
    s[b[i] - 1].insert(p[i]);
  }
  scanf("%d", &m);
  while (m--) {
    int x;
    scanf("%d", &x);
    if (s[x - 1].size() == 0) {
      printf("-1 ");
      continue;
    }
    int res = *s[x - 1].begin();
    printf("%d ", res);
    for (int i = 0; i < 3; i++) {
      if (s[i].find(res) != s[i].end()) s[i].erase(s[i].find(res));
    }
  }
}
