#include <bits/stdc++.h>
using namespace std;
int vis[200005], b[200005];
struct node {
  long long p, s, s1, s2, num;
} a[200005];
priority_queue<pair<long long, long long>> q1, q2, q3;
long long n, m, x;
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i].p;
    a[i].num = i;
  }
  for (int i = 0; i < n; i++) {
    cin >> a[i].s1;
  }
  for (int i = 0; i < n; i++) {
    cin >> a[i].s2;
  }
  for (int i = 0; i < n; i++) {
    if (a[i].s1 == 1 || a[i].s2 == 1) {
      q1.push({-a[i].p, a[i].num});
    }
    if (a[i].s1 == 2 || a[i].s2 == 2) {
      q2.push({-a[i].p, a[i].num});
    }
    if (a[i].s1 == 3 || a[i].s2 == 3) {
      q3.push({-a[i].p, a[i].num});
    }
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < m; i++) {
    if (b[i] == 1) {
      if (q1.empty())
        cout << "-1"
             << " ";
      if (!q1.empty()) {
        while (q1.size() && vis[q1.top().second]) q1.pop();
        if (q1.empty())
          cout << "-1"
               << " ";
        else {
          cout << -q1.top().first << " ";
          vis[q1.top().second] = 1;
        }
      }
    }
    if (b[i] == 2) {
      if (q2.empty())
        cout << "-1"
             << " ";
      if (!q2.empty()) {
        while (q2.size() && vis[q2.top().second]) q2.pop();
        if (q2.empty())
          cout << "-1"
               << " ";
        else {
          cout << -q2.top().first << " ";
          vis[q2.top().second] = 1;
          q2.pop();
        }
      }
    }
    if (b[i] == 3) {
      if (q3.empty())
        cout << "-1"
             << " ";
      if (!q3.empty()) {
        while (q3.size() && vis[q3.top().second]) q3.pop();
        if (q3.empty())
          cout << "-1"
               << " ";
        else {
          cout << -q3.top().first << " ";
          vis[q3.top().second] = 1;
          q3.pop();
        }
      }
    }
  }
  return 0;
}
