#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> pr(n);
  for (int i = 0; i < n; i++) cin >> pr[i];
  priority_queue<pair<int, int>> f;
  priority_queue<pair<int, int>> s;
  priority_queue<pair<int, int>> t;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x == 1)
      f.push({-pr[i], i});
    else if (x == 2)
      s.push({-pr[i], i});
    else
      t.push({-pr[i], i});
  }
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x == 1)
      f.push({-pr[i], i});
    else if (x == 2)
      s.push({-pr[i], i});
    else
      t.push({-pr[i], i});
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    if (x == 1) {
      int flag = 0;
      while (f.size() != 0) {
        int y = f.top().second;
        f.pop();
        if (pr[y] != -1) {
          cout << pr[y] << " ";
          flag = 1;
          pr[y] = -1;
          break;
        }
      }
      if (f.size() == 0 && flag == 0) cout << "-1 ";
    } else if (x == 2) {
      int flag = 0;
      while (s.size() != 0) {
        int y = s.top().second;
        s.pop();
        if (pr[y] != -1) {
          cout << pr[y] << " ";
          flag = 1;
          pr[y] = -1;
          break;
        }
      }
      if (s.size() == 0 && flag == 0) cout << "-1 ";
    } else {
      int flag = 0;
      while (t.size() != 0) {
        int y = t.top().second;
        t.pop();
        if (pr[y] != -1) {
          cout << pr[y] << " ";
          flag = 1;
          pr[y] = -1;
          break;
        }
      }
      if (t.size() == 0 && flag == 0) cout << "-1 ";
    }
  }
  return 0;
}
