#include <bits/stdc++.h>
using namespace std;
struct st {
  int v, a, b, id;
};
priority_queue<st> a[4];
bool sp[200010];
bool operator<(st a, st b) { return a.v > b.v; }
int n, m;
st tshirt[200010];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &tshirt[i].v), tshirt[i].id = i;
  for (int i = 1; i <= n; i++)
    scanf("%d", &tshirt[i].a), a[tshirt[i].a].push(tshirt[i]);
  for (int i = 1; i <= n; i++)
    scanf("%d", &tshirt[i].b), a[tshirt[i].b].push(tshirt[i]);
  scanf("%d", &m);
  int s;
  while (m--) {
    scanf("%d", &s);
    while (1) {
      if (a[s].empty()) {
        printf("-1 ");
        break;
      }
      st top = a[s].top();
      a[s].pop();
      if (!sp[top.id]) {
        sp[top.id] = 1;
        printf("%d ", top.v);
        break;
      }
    }
  }
}
