#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
double fRand(double fMin, double fMax) {
  double f = (double)rand() / RAND_MAX;
  return fMin + f * (fMax - fMin);
}
template <class T>
T min(T a, T b, T c) {
  return min(a, min(b, c));
}
template <class T>
T max(T a, T b, T c) {
  return max(a, max(b, c));
}
int n, q, p[200005], a[200005], b[200005];
vector<int> price[4][4];
int main() {
  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) price[a[i]][b[i]].push_back(p[i]);
  for (int i = (1); i <= (3); ++i)
    for (int j = (1); j <= (3); ++j)
      sort(price[i][j].rbegin(), price[i][j].rend());
  scanf("%d", &q);
  for (int i = (1); i <= (q); ++i) {
    int c;
    scanf("%d", &c);
    int ansI, ansJ, minP = 2000000007;
    for (int i = (1); i <= (3); ++i)
      for (int j = (1); j <= (3); ++j) {
        if ((i == c || j == c) && (int)price[i][j].size() > 0 &&
            *price[i][j].rbegin() < minP) {
          minP = *price[i][j].rbegin();
          ansI = i;
          ansJ = j;
        }
      }
    if (minP == 2000000007)
      minP = -1;
    else
      price[ansI][ansJ].pop_back();
    printf("%d ", minP);
  }
  return 0;
}
