#include <bits/stdc++.h>
using namespace std;
void Print(int _x) { printf("%d\n", _x); }
void Print(long long _x) { printf("%lld\n", _x); }
template <typename T>
void Print(T _a[], int _s, int _t) {
  for (int i = _s; i <= _t; i++) cout << _a[i] << " ";
  cout << endl;
}
struct InputReader {
  static const int bs = 100000;
  char buf[bs];
  int p;
  inline InputReader() : p(bs) {}
  inline void Flush() {
    p = 0;
    fread(buf, 1, bs, stdin);
  }
  inline char C() {
    if (p >= bs) Flush();
    return buf[p++];
  }
  int Getnum() {
    char ch = C();
    while (ch < '0' || ch > '9') ch = C();
    return (int)(ch - '0');
  }
  inline int operator()() {
    int ans = 0;
    char ch = C();
    int fu = 1;
    while (ch < '0' || ch > '9') {
      if (ch == '-') fu = -1;
      ch = C();
    }
    while (ch >= '0' && ch <= '9') {
      ans *= 10;
      ans += ch - '0';
      ch = C();
    }
    return ans * fu;
  }
  long long Readll() {
    long long ans = 0LL;
    long long fu = 1;
    char ch = C();
    while (ch < '0' || ch > '9') {
      if (ch == '-') fu = -1;
      ch = C();
    }
    while (ch >= '0' && ch <= '9') {
      ans *= 10LL;
      ans += ch - '0';
      ch = C();
    }
    return ans * fu;
  }
  inline void Readstring(string &x) {
    x.clear();
    char ch = C();
    while (!isdigit(ch) && !isalpha(ch)) ch = C();
    while (isdigit(ch) || isalpha(ch)) {
      x += ch;
      ch = C();
    }
  }
  inline void Readalpha(char &c) {
    c = C();
    while (!isalpha(c)) c = C();
  }
  inline void Specialread(char &c) {
    c = C();
    while (c != 'o' && c != 'x' && c != '?') c = C();
  }
} In;
inline void Read(int &x) { x = In(); }
inline void Read(int &x, int &y) {
  x = In();
  y = In();
}
inline void Read(int &x1, int &x2, int &x3) {
  x1 = In();
  x2 = In();
  x3 = In();
}
inline void Read(int &x1, int &x2, int &x3, int &x4) {
  x1 = In();
  x2 = In();
  x3 = In();
  x4 = In();
}
inline void Read(long long &x) { x = In.Readll(); }
inline void Read(long long &x, long long &y) {
  x = In.Readll();
  y = In.Readll();
}
inline void Read(long long &x1, long long &x2, long long &x3) {
  x1 = In.Readll();
  x2 = In.Readll();
  x3 = In.Readll();
}
inline void Read(long long &x1, long long &x2, long long &x3, long long &x4) {
  x1 = In.Readll();
  x2 = In.Readll();
  x3 = In.Readll();
  x4 = In.Readll();
}
clock_t _starttime, _endtime;
inline void FILEIO() {}
inline void END() { exit(0); }
int dx[] = {0, -1, 0, 1};
int dy[] = {1, 0, -1, 0};
int n;
pair<int, int> a[5][200010];
pair<int, int> b[5][200010];
int p1[5], p2[5];
int p[200010];
bool used[200010];
int m;
bool Cmp(pair<int, int> p1, pair<int, int> p2) { return p1.first > p2.first; }
int main() {
  FILEIO();
  memset(used, 0, sizeof(used));
  memset(p1, 0, sizeof(p1));
  memset(p2, 0, sizeof(p2));
  Read(n);
  for (register int(i) = 1; (i) <= (n); (i)++) Read(p[i]);
  for (register int(i) = 1; (i) <= (n); (i)++) {
    int x;
    Read(x);
    a[x][++p1[x]] = make_pair(p[i], i);
  }
  for (register int(i) = 1; (i) <= (n); (i)++) {
    int x;
    Read(x);
    b[x][++p2[x]] = make_pair(p[i], i);
  }
  for (register int(i) = 1; (i) <= (3); (i)++) {
    sort(a[i] + 1, a[i] + 1 + p1[i], Cmp);
    sort(b[i] + 1, b[i] + 1 + p2[i], Cmp);
  }
  Read(m);
  for (register int(i) = 1; (i) <= (m); (i)++) {
    int c;
    Read(c);
    int pr1 = (0x3f3f3f3f), pr2 = (0x3f3f3f3f);
    int aid, bid;
    while (p1[c] && used[a[c][p1[c]].second]) p1[c]--;
    if (p1[c]) {
      pr1 = a[c][p1[c]].first;
      aid = a[c][p1[c]].second;
    }
    while (p2[c] && used[b[c][p2[c]].second]) p2[c]--;
    if (p2[c]) {
      pr2 = b[c][p2[c]].first;
      bid = b[c][p2[c]].second;
    }
    int p, id;
    if (pr1 > pr2) {
      p = pr2;
      id = bid;
    } else {
      p = pr1;
      id = aid;
    }
    if (p == (0x3f3f3f3f)) {
      printf("-1 ");
      continue;
    }
    used[id] = 1;
    printf("%d ", p);
  }
  END();
}
