#include <bits/stdc++.h>
using namespace std;
void FAST() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long int power(long long int num, long long int r) {
  if (r == 0) return 1;
  if (r == 1) return num % 1000000007;
  long long int ans = power(num, r / 2) % 1000000007;
  if (r % 2 == 0) {
    return (ans * ans) % 1000000007;
  }
  return (((ans * ans) % 1000000007) * num) % 1000000007;
}
long long int modinv(long long int num) { return power(num, 1000000007 - 2); }
long long int nCr(long long int n, long long int r) {
  if (r == 0 || r == n) return 1;
  long long int fac[n + 1];
  fac[0] = 1;
  for (long long int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % 1000000007;
  long long int ans = ((fac[n] * modinv(fac[r])) % 1000000007);
  ans *= (modinv(fac[n - r]) % 1000000007);
  ans %= 1000000007;
  return ans;
}
class Triplet {
 public:
  long long int gcd;
  long long int x;
  long long int y;
};
Triplet gcdExtEuclid(long long int a, long long int b) {
  if (b == 0) {
    Triplet myAns;
    myAns.gcd = a;
    myAns.x = 1;
    myAns.y = 0;
    return myAns;
  }
  Triplet smaintAns = gcdExtEuclid(b, a % b);
  Triplet myAns;
  myAns.gcd = smaintAns.gcd;
  myAns.x = smaintAns.y;
  myAns.y = (smaintAns.x - ((a / b) * (smaintAns.y)));
  return myAns;
}
long long int gcd(long long int a, long long int b) {
  if (a < b) {
    return gcd(b, a);
  }
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long int modinvM(long long int A, long long int M) {
  Triplet ans = gcdExtEuclid(A, M);
  return ans.x;
}
bool* makeSieve(long long int n) {
  bool* isPrime = new bool[n + 1];
  for (long long int i = 0; i <= n; i++) {
    isPrime[i] = true;
  }
  isPrime[0] = false;
  isPrime[1] = false;
  for (long long int i = 2; i * i <= n; i++) {
    for (long long int j = i * i; j <= n; j += i) {
      isPrime[j] = false;
    }
  }
  return isPrime;
}
map<long long int, long long int> factorize(long long int n) {
  map<long long int, long long int> ans;
  bool* isPrime = makeSieve((long long int)sqrt(n));
  for (long long int i = 2; i * i <= n; i++) {
    if (isPrime[i] == true) {
      while (n % i == 0) {
        ans[i]++;
        n /= i;
      }
    }
  }
  delete[] isPrime;
  if (n > 1) {
    ans[n]++;
    n = 1;
  }
  return ans;
}
struct price_val {
  long long int p;
  long long int a;
  long long int b;
};
bool compare(price_val pv1, price_val pv2) { return pv1.p < pv2.p; }
int32_t main() {
  FAST();
  long long int n;
  cin >> n;
  vector<long long int> arr1, arr2, arr3;
  price_val price[n];
  unordered_map<long long int, long long int> price_map;
  long long int p;
  for (long long int i = 0; i < n; i++) {
    cin >> p;
    price_map[p]++;
    price[i].p = p;
  }
  long long int a, b;
  for (long long int i = 0; i < n; i++) {
    cin >> a;
    price[i].a = a;
  }
  for (long long int i = 0; i < n; i++) {
    cin >> b;
    price[i].b = b;
  }
  sort(price, price + n, compare);
  for (long long int i = 0; i < n; i++) {
    if (price[i].a == 1 || price[i].b == 1) arr1.push_back(price[i].p);
    if (price[i].a == 2 || price[i].b == 2) arr2.push_back(price[i].p);
    if (price[i].a == 3 || price[i].b == 3) arr3.push_back(price[i].p);
  }
  long long int m, color, i1 = 0, i2 = 0, i3 = 0;
  cin >> m;
  for (long long int i = 0; i < m; i++) {
    cin >> color;
    if (color == 1) {
      long long int found = 0;
      if (i1 < arr1.size()) {
        do {
          if (price_map[arr1[i1]] == 1) {
            cout << arr1[i1] << " ";
            price_map[arr1[i1]]--;
            found = 1;
          }
          i1++;
        } while (found == 0 && i1 < arr1.size());
      }
      if (found == 0) cout << -1 << " ";
    } else if (color == 2) {
      long long int found = 0;
      if (i2 < arr2.size()) {
        do {
          if (price_map[arr2[i2]] == 1) {
            cout << arr2[i2] << " ";
            price_map[arr2[i2]]--;
            found = 1;
          }
          i2++;
        } while (found == 0 && i2 < arr2.size());
      }
      if (found == 0) cout << -1 << " ";
    } else if (color == 3) {
      long long int found = 0;
      if (i3 < arr3.size()) {
        do {
          if (price_map[arr3[i3]] == 1) {
            cout << arr3[i3] << " ";
            price_map[arr3[i3]]--;
            found = 1;
          }
          i3++;
        } while (found == 0 && i3 < arr3.size());
      }
      if (found == 0) cout << -1 << " ";
    }
  }
  return 0;
}
