#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, p[200005], m, i;
  int a[200005], b[200005];
  set<int> s[4];
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (i = 0; i < n; i++) {
    cin >> a[i];
    s[a[i]].insert(p[i]);
  }
  for (i = 0; i < n; ++i) {
    scanf("%d", &b[i]);
    if (a[i] != b[i]) s[b[i]].insert(p[i]);
  }
  cin >> m;
  int x;
  for (i = 0; i < m; i++) {
    cin >> x;
    if (s[x].empty())
      printf("-1 ");
    else {
      int c = *s[x].begin();
      printf("%d ", c);
      if (s[1].find(c) != s[1].end()) s[1].erase(c);
      if (s[2].find(c) != s[2].end()) s[2].erase(c);
      if (s[3].find(c) != s[3].end()) s[3].erase(c);
    }
  }
}
