#include <bits/stdc++.h>
using namespace std;
const int mx = 3e5 + 10;
int main() {
  vector<vector<pair<int, int> > > arr(4);
  vector<int> a, b, c;
  map<int, int> visit;
  int n, m, x, d[5] = {0, 0, 0, 0};
  scanf("%d", &n);
  for (int j = 0; j < 3; j++) {
    for (int i = 0; i < n; i++) {
      scanf("%d", &x);
      if (j == 0) a.push_back(x);
      if (j == 1) b.push_back(x);
      if (j == 2) c.push_back(x);
    }
  }
  for (int i = 0; i < n; i++) {
    arr[b[i] - 1].push_back(make_pair(a[i], i));
    if (b[i] != c[i]) arr[c[i] - 1].push_back(make_pair(a[i], i));
  }
  for (int i = 0; i < 3; i++) {
    if (arr[i].size() > 1) sort(arr[i].begin(), arr[i].end());
  }
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d", &x);
    x--;
    int get = 0;
    for (int j = d[x]; j < arr[x].size(); j++) {
      if (visit[arr[x][j].second] == 0) {
        cout << arr[x][j].first;
        d[x] = j + 1;
        get = 1;
        visit[arr[x][j].second] = 1;
        break;
      }
    }
    if (get == 0) cout << "-1";
    if (i != m - 1) cout << " ";
  }
  cout << endl;
}
