#include <bits/stdc++.h>
using namespace std;
int n, aux, m, fav;
int p[200001];
vector<int> col1;
vector<int> col2;
vector<int> col3;
bool cmp(const int& v, const int& w) { return p[v] < p[w]; }
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> p[i];
  }
  for (int i = 1; i <= n; ++i) {
    cin >> aux;
    if (aux == 1) col1.push_back(i);
    if (aux == 2) col2.push_back(i);
    if (aux == 3) col3.push_back(i);
  }
  for (int i = 1; i <= n; ++i) {
    cin >> aux;
    if (aux == 1) col1.push_back(i);
    if (aux == 2) col2.push_back(i);
    if (aux == 3) col3.push_back(i);
  }
  sort(col1.begin(), col1.end(), cmp);
  sort(col2.begin(), col2.end(), cmp);
  sort(col3.begin(), col3.end(), cmp);
  col1.push_back(-1);
  col2.push_back(-1);
  col3.push_back(-1);
  cin >> m;
  int last[4] = {0, 0, 0, 0};
  for (int i = 1; i <= m; ++i) {
    cin >> fav;
    if (fav == 1) {
      while (p[col1[last[fav]]] == -1) last[fav]++;
      if (col1[last[fav]] == -1)
        cout << "-1 ";
      else
        cout << p[col1[last[fav]]] << " ", p[col1[last[fav]]] = -1, last[fav]++;
    }
    if (fav == 2) {
      while (p[col2[last[fav]]] == -1) last[fav]++;
      if (col2[last[fav]] == -1)
        cout << "-1 ";
      else
        cout << p[col2[last[fav]]] << " ", p[col2[last[fav]]] = -1, last[fav]++;
    }
    if (fav == 3) {
      while (p[col3[last[fav]]] == -1) last[fav]++;
      if (col3[last[fav]] == -1)
        cout << "-1 ";
      else
        cout << p[col3[last[fav]]] << " ", p[col3[last[fav]]] = -1, last[fav]++;
    }
  }
  return 0;
}
