#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 123;
const long long INF = (long long)1e18 + 123;
const int inf = (int)1e9 + 123;
const int MOD = (int)1e9 + 7;
int main() {
  int n, c, x;
  vector<int> costs, front, back;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x);
    costs.push_back(x);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    front.push_back(x);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    back.push_back(x);
  }
  vector<pair<int, int> > v[4];
  for (int i = 1; i <= 3; i++) {
    for (int j = 0; j < n; j++) {
      if (front[j] == i) v[i].push_back(make_pair(costs[j], j));
      if (front[j] != back[j] && back[j] == i)
        v[i].push_back(make_pair(costs[j], j));
    }
  }
  for (int i = 1; i <= 3; ++i) sort(v[i].begin(), v[i].end());
  int used[n];
  memset(used, 0, sizeof(used));
  queue<pair<int, int> > Q[4];
  for (int i = 1; i < 4; i++) {
    for (int j = 0; j < v[i].size(); j++) {
      Q[i].push(v[i][j]);
    }
  }
  scanf("%d", &c);
  for (int i = 0; i < c; i++) {
    scanf("%d", &x);
    if (Q[x].empty()) {
      printf("-1 ");
    } else {
      while (!Q[x].empty() && used[Q[x].front().second] == 1) {
        Q[x].pop();
      }
      if (Q[x].empty()) {
        printf("-1 ");
      } else {
        printf("%d ", Q[x].front().first);
        used[Q[x].front().second] = 1;
        Q[x].pop();
      }
    }
  }
  printf("\n");
  return 0;
}
