#include <bits/stdc++.h>
using namespace std;
const long long int N = 2e5 + 7;
long long flag[N], c[N];
struct item {
  long long p, a, b;
};
set<int> color[5];
item it[N];
int main() {
  int n, m;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> it[i].p;
  for (int i = 1; i <= n; i++) cin >> it[i].a;
  for (int i = 1; i <= n; i++) cin >> it[i].b;
  for (int i = 1; i <= n; i++) {
    color[it[i].a].insert(it[i].p);
    color[it[i].b].insert(it[i].p);
  }
  cin >> m;
  for (int i = 1; i <= m; i++) cin >> c[i];
  for (int i = 1; i <= m; i++) {
    if (color[c[i]].size() == 0)
      printf("-1\n");
    else {
      int tmp = *(color[c[i]].begin());
      cout << tmp << ' ';
      for (int i = 1; i <= 3; i++) color[i].erase(tmp);
    }
  }
  return 0;
}
