#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
void solve() {
  int n;
  cin >> n;
  pair<int, pair<int, int> > p[n];
  for (int i = 0; i < n; i++) {
    cin >> p[i].first;
  }
  for (int i = 0; i < n; i++) {
    cin >> p[i].second.first;
  }
  for (int i = 0; i < n; i++) {
    cin >> p[i].second.second;
  }
  sort(p, p + n);
  bool have[4][n];
  for (int i = 1; i <= 3; i++) {
    for (int j = 0; j < n; j++) {
      if (p[j].second.first == i || p[j].second.second == i) {
        have[i][j] = true;
      } else {
        have[i][j] = false;
      }
    }
  }
  int m;
  cin >> m;
  int indices[4];
  for (int i = 1; i <= 3; i++) indices[i] = -1;
  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= 3; j++) {
      if (indices[j] == -1 && have[j][i] == true) {
        indices[j] = i;
      }
    }
  }
  bool got[n];
  for (int i = 0; i < n; i++) got[i] = false;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    if (indices[x] == -1) {
      cout << -1 << " ";
    } else {
      cout << p[indices[x]].first << " ";
      got[indices[x]] = true;
      int XXX = indices[x];
      for (int r = 1; r <= 3; r++) {
        if (indices[r] == XXX) {
          int y = indices[r] + 1;
          while (y < n && (have[r][y] == false ||
                           (have[r][y] == true && got[y] == true))) {
            y++;
          }
          if (y == n)
            indices[r] = -1;
          else
            indices[r] = y;
        }
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}
