#include <bits/stdc++.h>
using namespace std;
struct pab {
  int p;
  pair<int, int> pi;
};
const int inf = 1e9 + 1;
int main() {
  int n;
  while (cin >> n) {
    map<pair<int, int>, priority_queue<int, vector<int>, greater<int> > > mp;
    vector<pab> vp(n);
    for (int i = 0; i < n; ++i) {
      cin >> vp[i].p;
    }
    for (int i = 0; i < n; ++i) {
      cin >> vp[i].pi.first;
    }
    for (int i = 0; i < n; ++i) {
      cin >> vp[i].pi.second;
    }
    for (int i = 0; i < n; ++i) {
      map<pair<int, int>,
          priority_queue<int, vector<int>, greater<int> > >::iterator it =
          mp.find(vp[i].pi);
      priority_queue<int, vector<int>, greater<int> > pq;
      pq.push(vp[i].p);
      if (it != mp.end())
        it->second.push(vp[i].p);
      else
        mp.insert(make_pair(vp[i].pi, pq));
    }
    int m;
    cin >> m;
    while (m--) {
      int c;
      cin >> c;
      int minp = inf;
      map<pair<int, int>,
          priority_queue<int, vector<int>, greater<int> > >::iterator it,
          finalit = mp.end();
      for (int i = 1; i <= 3; ++i) {
        it = mp.find(make_pair(i, c));
        if (it != mp.end() && !it->second.empty()) {
          if (minp > it->second.top()) {
            minp = it->second.top();
            finalit = it;
          }
        }
        it = mp.find(make_pair(c, i));
        if (it != mp.end() && !it->second.empty()) {
          if (minp > it->second.top()) {
            minp = it->second.top();
            finalit = it;
          }
        }
      }
      if (minp == inf)
        cout << "-1"
             << " ";
      else {
        if (finalit->second.empty())
          mp.erase(finalit);
        else
          finalit->second.pop();
        cout << minp << " ";
      }
    }
  }
}
