#include <bits/stdc++.h>
using namespace std;
struct node {
  int p;
  int order;
  friend bool operator<(node z, node y) { return z.p > y.p; }
} e;
struct node a[200005];
bool vis[200005];
priority_queue<node> q[4];
int main() {
  int n, m;
  scanf("%d", &n);
  int i;
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i].p);
    a[i].order = i;
  }
  for (i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    q[x].push(a[i]);
    vis[i] = true;
  }
  for (i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    q[x].push(a[i]);
  }
  scanf("%d", &m);
  while (m--) {
    int x;
    scanf("%d", &x);
    while (1) {
      if (q[x].size() == 0) {
        printf("-1 ");
        break;
      } else {
        e = q[x].top();
        q[x].pop();
        int k = e.order;
        if (vis[k] == false)
          continue;
        else {
          printf("%d ", e.p);
          vis[k] = false;
          break;
        }
      }
    }
  }
  return 0;
}
