#include <bits/stdc++.h>
using namespace std;
vector<int> v[3][3];
int n, pr[200005], a[200005];
int main() {
  scanf("%d", &n);
  for (int i = (1); i <= (n); i++) scanf("%d", &pr[i]);
  for (int i = (1); i <= (n); i++) scanf("%d", &a[i]);
  for (int i = (1); i <= (n); i++) {
    int b;
    scanf("%d", &b);
    v[a[i] - 1][b - 1].push_back(-pr[i]);
  }
  for (int i = (0); i <= (2); i++)
    for (int j = (0); j <= (2); j++) sort(v[i][j].begin(), v[i][j].end());
  int q, x;
  scanf("%d", &q);
  while (q) {
    scanf("%d", &x);
    x--;
    int ta = -1, tb;
    for (int i = (0); i <= (2); i++)
      for (int j = (0); j <= (2); j++)
        if (i == x || j == x) {
          int sz = v[i][j].size();
          if (sz) {
            if (ta == -1) {
              ta = i, tb = j;
            } else if (v[i][j].back() > v[ta][tb].back()) {
              ta = i, tb = j;
            }
          }
        }
    if (ta == -1)
      printf("-1");
    else {
      printf("%d", -v[ta][tb].back());
      v[ta][tb].pop_back();
    }
    printf("%c", --q ? ' ' : '\n');
  }
  return 0;
}
