#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 10;
const int inf = 0x3f3f3f3f;
int n, m;
int p[maxn];
int a[maxn];
int b[maxn];
int c[maxn];
bool vis[maxn];
vector<int> s[4];
int start[4];
bool cmp(int x, int y) { return p[x] < p[y]; }
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> p[i];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    s[a[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    s[b[i]].push_back(i);
  }
  for (int i = 1; i <= 3; i++) sort(s[i].begin(), s[i].end(), cmp);
  cin >> m;
  for (int i = 1; i <= m; i++) cin >> c[i];
  for (int i = 1; i <= m; i++) {
    bool flag = 0;
    for (int j = start[c[i]]; j < s[c[i]].size(); j++) {
      int t = s[c[i]][j];
      if (!vis[t]) {
        flag = 1;
        cout << p[t] << " ";
        vis[t] = 1;
        start[c[i]] = j + 1;
        break;
      }
    }
    if (!flag) cout << -1 << " ";
  }
  return 0;
}
