#include <bits/stdc++.h>
using namespace std;
struct A {
  int s, in;
  bool operator<(const A& b) const {
    if (s > b.s)
      return true;
    else
      return false;
  }
};
A tp;
priority_queue<A> q1, q2, q3;
int a[200100];
int mark[200100];
int main() {
  int n, h, m;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &h);
    tp.s = a[i], tp.in = i;
    if (h == 1)
      q1.push(tp);
    else if (h == 2)
      q2.push(tp);
    else
      q3.push(tp);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &h);
    tp.s = a[i], tp.in = i;
    if (h == 1)
      q1.push(tp);
    else if (h == 2)
      q2.push(tp);
    else
      q3.push(tp);
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &h);
    if (h == 1) {
      while (!q1.empty()) {
        if (!mark[q1.top().in]) break;
        q1.pop();
      }
      if (q1.empty())
        printf("-1\n");
      else {
        printf("%d ", q1.top().s);
        mark[q1.top().in] = 1;
        q1.pop();
      }
    } else if (h == 2) {
      while (!q2.empty()) {
        if (!mark[q2.top().in]) break;
        q2.pop();
      }
      if (q2.empty())
        printf("-1\n");
      else {
        printf("%d ", q2.top().s);
        mark[q2.top().in] = 1;
        q2.pop();
      }
    } else {
      while (!q3.empty()) {
        if (!mark[q3.top().in]) break;
        q3.pop();
      }
      if (q3.empty())
        printf("-1\n");
      else {
        printf("%d ", q3.top().s);
        mark[q3.top().in] = 1;
        q3.pop();
      }
    }
  }
  return 0;
}
