#include <bits/stdc++.h>
using namespace std;
const int kMaxN = 2e5 + 10;
set<pair<int, int>> S[3][3];
int a[kMaxN], b[kMaxN], p[kMaxN];
void check(int& i, int aa, int bb) {
  auto it = S[aa][bb].begin();
  if (it != S[aa][bb].end()) {
    if (i == -1 || it->first < p[i]) {
      i = it->second;
    }
  }
}
void Solve() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &p[i]);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &b[i]);
  }
  for (int i = 1; i <= n; ++i) {
    S[a[i] - 1][b[i] - 1].insert({p[i], i});
  }
  int m;
  scanf("%d", &m);
  for (int i = 1; i <= m; ++i) {
    int c;
    scanf("%d", &c);
    int wh = -1;
    for (int i = 1; i <= 3; ++i) {
      check(wh, i - 1, c - 1);
      check(wh, c - 1, i - 1);
    }
    if (wh == -1) {
      cout << -1 << " ";
    } else {
      cout << p[wh] << " ";
      S[a[wh] - 1][b[wh] - 1].erase({p[wh], wh});
    }
  }
  cout << "\n";
}
void Reset() {
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      S[i][j].clear();
    }
  }
}
int main() {
  int tests = 1;
  for (; tests; --tests) {
    Solve();
    Reset();
  }
}
