#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
const int maxn = 2e5 + 10;
const long long mod = 1e9 + 7;
long long fsp(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans % mod;
}
int read() {
  int f = 1, x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return f * x;
}
int n, m, p[maxn];
set<pair<int, int> > s[5];
void work() {
  for (int i = 1; i <= 3; i++) s[i].clear();
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    s[x].insert(pair<int, int>(p[i], i));
  }
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    s[x].insert(pair<int, int>(p[i], i));
  }
  scanf("%d", &m);
  while (m--) {
    int x;
    scanf("%d", &x);
    if (s[x].empty())
      printf("-1 ");
    else {
      int pos = s[x].begin()->second;
      for (int i = 1; i <= 3; i++) s[i].erase(pair<int, int>(p[pos], pos));
      printf("%d ", p[pos]);
    }
  }
}
int main() {
  while (~scanf("%d", &n)) {
    work();
  }
  return 0;
}
