#include <bits/stdc++.h>
using namespace std;
int prices[200005];
int C1[200005];
int C2[200005];
priority_queue<int, vector<int>, greater<int> > arr1[5];
priority_queue<int, vector<int>, greater<int> > arr2[5];
map<int, bool> used;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%d", &prices[i]);
  for (int i = 0; i < n; i++) scanf("%d", &C1[i]);
  for (int i = 0; i < n; i++) scanf("%d", &C2[i]);
  for (int i = 0; i < n; i++) {
    arr1[C1[i]].push(prices[i]);
    if (C1[i] != C2[i]) arr2[C2[i]].push(prices[i]);
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int x;
    scanf("%d", &x);
    int firstBest = 1e9 + 2;
    int secondBest = 1e9 + 2;
    while (arr1[x].size() > 0) {
      int tope = arr1[x].top();
      arr1[x].pop();
      if (!used[tope]) {
        used[tope] = true;
        firstBest = tope;
        break;
      }
    }
    while (arr2[x].size() > 0) {
      int tope = arr2[x].top();
      arr2[x].pop();
      if (!used[tope]) {
        used[tope] = true;
        secondBest = tope;
        break;
      }
    }
    if (firstBest == secondBest && firstBest == 1e9 + 2)
      printf("%d ", -1);
    else
      printf("%d ", min(firstBest, secondBest));
    if (min(firstBest, secondBest) == 1e9 + 2) continue;
    if (firstBest == min(firstBest, secondBest)) {
      arr2[x].push(secondBest);
      used[secondBest] = false;
    } else {
      arr1[x].push(firstBest);
      used[firstBest] = false;
    }
  }
  return 0;
}
