#include <bits/stdc++.h>
using namespace std;
int p[200001];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  set<long long int> ss[4];
  set<long long int>::iterator it;
  for (int i = 0; i < n; i++) {
    int in;
    cin >> in;
    ss[in].insert(p[i]);
  }
  for (int i = 0; i < n; i++) {
    int in;
    cin >> in;
    ss[in].insert(p[i]);
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    it = ss[x].begin();
    if (it == ss[x].end()) {
      cout << "-1"
           << " ";
    } else {
      int y = *it;
      cout << y << " ";
      ss[1].erase(y);
      ss[2].erase(y);
      ss[3].erase(y);
    }
  }
}
