#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
struct node {
  int p1, a1, b1;
};
node p[N];
queue<int> a1, a2, a3;
bool vis[N];
bool cmp(node x, node y) { return x.p1 < y.p1; }
int main() {
  int n;
  scanf("%d", &n);
  int cnt1 = 0, cnt2 = 0, cnt3 = 0;
  for (int i = 0; i < n; i++) scanf("%d", &p[i].p1);
  for (int i = 0; i < n; i++) scanf("%d", &p[i].a1);
  for (int i = 0; i < n; i++) scanf("%d", &p[i].b1);
  sort(p, p + n, cmp);
  for (int i = 0; i < n; i++) {
    if (p[i].a1 == 1 || p[i].b1 == 1) a1.push(i);
    if (p[i].a1 == 2 || p[i].b1 == 2) a2.push(i);
    if (p[i].a1 == 3 || p[i].b1 == 3) a3.push(i);
  }
  int m;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    int num;
    scanf("%d", &num);
    if (num == 1) {
      int flag = 0;
      while (!a1.empty()) {
        int nnn = a1.front();
        a1.pop();
        if (!vis[nnn]) {
          flag = 1;
          printf("%d ", p[nnn].p1);
          vis[nnn] = 1;
          break;
        }
      }
      if (!flag) printf("-1 ");
    } else if (num == 2) {
      int flag = 0;
      while (!a2.empty()) {
        int nnn = a2.front();
        a2.pop();
        if (!vis[nnn]) {
          flag = 1;
          printf("%d ", p[nnn].p1);
          vis[nnn] = 1;
          break;
        }
      }
      if (!flag) printf("-1 ");
    } else {
      int flag = 0;
      while (!a3.empty()) {
        int nnn = a3.front();
        a3.pop();
        if (!vis[nnn]) {
          flag = 1;
          printf("%d ", p[nnn].p1);
          vis[nnn] = 1;
          break;
        }
      }
      if (!flag) printf("-1 ");
    }
  }
  cout << endl;
  return 0;
}
