#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int n;
int p[N], a[N], b[N];
vector<int> v[4][4];
int idx[4][4];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &p[i]);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
    v[a[i]][b[i]].push_back(p[i]);
  }
  for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= 3; j++) {
      sort(v[i][j].begin(), v[i][j].end());
      reverse(v[i][j].begin(), v[i][j].end());
    }
  }
  int m;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    int x;
    scanf("%d", &x);
    int ans = 2e9;
    int f = 5, s = 5;
    for (int j = 1; j <= 3; j++) {
      if (!v[x][j].empty() && v[x][j].back() < ans) {
        ans = v[x][j].back();
        f = x;
        s = j;
      }
      if (!v[j][x].empty() && v[j][x].back() < ans) {
        ans = v[j][x].back();
        f = j;
        s = x;
      }
    }
    if (ans == 2e9) {
      printf("-1 ");
    } else {
      printf("%d ", ans);
      v[f][s].pop_back();
    }
  }
  return 0;
}
