#include <bits/stdc++.h>
using namespace std;
int arr[200005], arr1[200005], arr2[200005], arr3[200005], arr4[200005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, n1;
  multiset<int> s1;
  multiset<int> s2;
  multiset<int> s3;
  cin >> n;
  for (int i = (0); i < (n); i++) {
    cin >> arr1[i];
  }
  for (int i = (0); i < (n); i++) {
    cin >> arr3[i];
    if (arr3[i] == 1)
      s1.insert(arr1[i]);
    else if (arr3[i] == 2)
      s2.insert(arr1[i]);
    else
      s3.insert(arr1[i]);
  }
  for (int i = (0); i < (n); i++) {
    cin >> arr4[i];
    if (arr4[i] == 1 && arr4[i] != arr3[i])
      s1.insert(arr1[i]);
    else if (arr4[i] == 2 && arr4[i] != arr3[i])
      s2.insert(arr1[i]);
    else if (arr4[i] == 3 && arr4[i] != arr3[i])
      s3.insert(arr1[i]);
  }
  multiset<int>::iterator it1;
  multiset<int>::iterator it2;
  multiset<int>::iterator it3;
  it1 = s1.begin();
  it2 = s2.begin();
  it3 = s3.begin();
  cin >> n1;
  for (int i = (0); i < (n1); i++) {
    cin >> arr[i];
    if (arr[i] == 1) {
      if (!s1.empty()) {
        arr2[i] = *it1;
        it2 = s2.find(arr2[i]);
        if (it2 != s2.end()) s2.erase(it2);
        if (!s2.empty()) it2 = s2.begin();
        s1.erase(it1);
        it3 = s3.find(arr2[i]);
        if (it3 != s3.end()) {
          s3.erase(it3);
        }
        if (!s3.empty()) it3 = s3.begin();
        if (!s1.empty()) it1 = s1.begin();
      } else
        arr2[i] = -1;
    } else if (arr[i] == 2) {
      if (!s2.empty()) {
        arr2[i] = *it2;
        s2.erase(it2);
        if (!s2.empty()) it2 = s2.begin();
        it1 = s1.find(arr2[i]);
        if (it1 != s1.end()) s1.erase(it1);
        if (!s1.empty()) it1 = s1.begin();
        it3 = s3.find(arr2[i]);
        if (it3 != s3.end()) s3.erase(it3);
        if (!s3.empty()) it3 = s3.begin();
      } else
        arr2[i] = -1;
    } else {
      if (!s3.empty()) {
        arr2[i] = *it3;
        s3.erase(it3);
        if (!s3.empty()) it3 = s3.begin();
        it1 = s1.find(arr2[i]);
        if (it1 != s1.end()) s1.erase(it1);
        if (!s1.empty()) it1 = s1.begin();
        it2 = s2.find(arr2[i]);
        if (it2 != s2.end()) s2.erase(it2);
        if (!s2.empty()) it2 = s2.begin();
      } else
        arr2[i] = -1;
    }
  }
  for (int i = (0); i < (n1); i++) cout << arr2[i] << " ";
  return 0;
}
