#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
bool vis[maxn] = {0};
struct node {
  int num;
  int cost;
  bool operator<(const node d) const { return d.cost < cost; }
};
int p[maxn] = {0};
int n, m;
priority_queue<node> q1;
priority_queue<node> q2;
priority_queue<node> q3;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
  }
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    if (x == 1) {
      q1.push({i, p[i]});
    } else if (x == 2) {
      q2.push({i, p[i]});
    } else {
      q3.push({i, p[i]});
    }
  }
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    if (x == 1) {
      q1.push({i, p[i]});
    } else if (x == 2) {
      q2.push({i, p[i]});
    } else {
      q3.push({i, p[i]});
    }
  }
  cin >> m;
  for (int i = 0; i < m; ++i) {
    int x;
    cin >> x;
    if (x == 1) {
      if (q1.empty()) {
        cout << -1 << ' ';
        continue;
      } else {
        int ok = 1;
        while (!q1.empty()) {
          node u = q1.top();
          q1.pop();
          if (!vis[u.num]) {
            vis[u.num] = true;
            cout << u.cost << ' ';
            ok = 0;
            break;
          }
        }
        if (ok) {
          cout << -1 << ' ';
          continue;
        }
      }
    }
    if (x == 2) {
      if (q2.empty()) {
        cout << -1 << ' ';
        continue;
      } else {
        int ok = 1;
        while (!q2.empty()) {
          node u = q2.top();
          q2.pop();
          if (!vis[u.num]) {
            vis[u.num] = true;
            cout << u.cost << ' ';
            ok = 0;
            break;
          }
        }
        if (ok) {
          cout << -1 << ' ';
          continue;
        }
      }
    }
    if (x == 3) {
      if (q3.empty()) {
        cout << -1 << ' ';
        continue;
      } else {
        int ok = 1;
        while (!q3.empty()) {
          node u = q3.top();
          q3.pop();
          if (!vis[u.num]) {
            vis[u.num] = true;
            cout << u.cost << ' ';
            ok = 0;
            break;
          }
        }
        if (ok) {
          cout << -1 << ' ';
          continue;
        }
      }
    }
  }
  return 0;
}
