#include <bits/stdc++.h>
using namespace std;
int n, m, mn, u;
int p[200010], x[200010], y[200010];
set<int> se[2][4];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x[i]);
    se[0][x[i]].insert(p[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &y[i]);
    se[1][y[i]].insert(p[i]);
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &u);
    mn = 0x3f3f3f3f;
    if (!se[0][u].empty()) mn = min(mn, *se[0][u].begin());
    if (!se[1][u].empty()) mn = min(mn, *se[1][u].begin());
    if (mn != -1)
      for (int i = 1; i <= 3; i++) {
        if (!se[0][i].empty() && se[0][i].find(mn) != se[0][i].end())
          se[0][i].erase(se[0][i].find(mn));
        if (!se[1][i].empty() && se[1][i].find(mn) != se[1][i].end())
          se[1][i].erase(se[1][i].find(mn));
      }
    printf("%d\n", mn == 0x3f3f3f3f ? -1 : mn);
  }
  return 0;
}
