#include <bits/stdc++.h>
using namespace std;
struct node {
  int p, a, b, id;
};
node col[200006];
class Compare {
 public:
  bool operator()(node n1, node n2) {
    if (n1.p > n2.p)
      return true;
    else
      return false;
  }
};
int c[200006];
int mark[200006];
priority_queue<node, std::vector<node>, Compare> q[4];
int main() {
  int n, m;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &col[i].p);
    col[i].id = i;
    mark[i] = 0;
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &col[i].a);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &col[i].b);
  }
  for (int i = 0; i < n; ++i) {
    q[col[i].a].push(col[i]);
    q[col[i].b].push(col[i]);
  }
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d", &c[i]);
    node t;
    int fg = 0;
    while (!q[c[i]].empty()) {
      t = q[c[i]].top();
      q[c[i]].pop();
      if (mark[t.id])
        continue;
      else {
        fg = 1;
        mark[t.id] = 1;
        break;
      }
    }
    if (fg)
      printf("%d ", t.p);
    else
      printf("-1 ");
  }
  return 0;
}
