#include <bits/stdc++.h>
using namespace std;
set<int> S1, S2, S3;
map<int, bool> vis;
int p[2000001], a[200001], b[2000001];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++) {
    if (a[i] == 1 || b[i] == 1) S1.insert(p[i]);
    if (a[i] == 2 || b[i] == 2) S2.insert(p[i]);
    if (a[i] == 3 || b[i] == 3) S3.insert(p[i]);
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int c;
    cin >> c;
    if (c == 1) {
      if (S1.empty())
        cout << -1 << ' ';
      else {
        auto ans = S1.begin();
        S2.erase(*ans);
        S3.erase(*ans);
        cout << *ans << ' ';
        S1.erase(*ans);
      }
    } else if (c == 2) {
      if (S2.empty())
        cout << -1 << ' ';
      else {
        auto ans = S2.begin();
        S1.erase(*ans);
        S3.erase(*ans);
        cout << *ans << ' ';
        S2.erase(*ans);
      }
    } else {
      if (S3.empty())
        cout << -1 << ' ';
      else {
        auto ans = S3.begin();
        S1.erase(*ans);
        S2.erase(*ans);
        cout << *ans << ' ';
        S3.erase(*ans);
      }
    }
  }
}
