#include <bits/stdc++.h>
using namespace std;
int prices[200000];
int front[200000];
int back[200000];
vector<int> shirts[3][3];
bool comp(const int& a, const int& b) { return prices[a] > prices[b]; }
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) scanf("%d", prices + i);
  for (int i = 0; i < N; i++) scanf("%d", front + i);
  for (int i = 0; i < N; i++) scanf("%d", back + i);
  for (int i = 0; i < N; i++) shirts[front[i] - 1][back[i] - 1].push_back(i);
  for (int i = 0; i < 9; i++)
    sort(shirts[i / 3][i % 3].begin(), shirts[i / 3][i % 3].end(), comp);
  int M;
  scanf("%d", &M);
  for (int i = 0; i < M; i++) {
    int c;
    scanf("%d", &c);
    c--;
    pair<int, int> best(-1, -1);
    int bVal = 2000000000;
    for (int a = 0; a < 3; a++)
      if (shirts[a][c].size() > 0)
        if (prices[shirts[a][c][shirts[a][c].size() - 1]] < bVal) {
          best = pair<int, int>(a, c);
          bVal = prices[shirts[a][c][shirts[a][c].size() - 1]];
        }
    for (int a = 0; a < 3; a++)
      if (shirts[c][a].size() > 0)
        if (prices[shirts[c][a][shirts[c][a].size() - 1]] < bVal) {
          best = pair<int, int>(c, a);
          bVal = prices[shirts[c][a][shirts[c][a].size() - 1]];
        }
    if (best.first != -1 && best.second != -1) {
      shirts[best.first][best.second].pop_back();
      printf("%d ", bVal);
    } else
      printf("-1 ");
  }
}
