#include <bits/stdc++.h>
using namespace std;
int Set(int n, int pos) { return (n = n | 1 << pos); }
int reset(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
long long pow(long long a, long long b, long long mod) {
  long long x = 1, y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y);
      if (x > mod) x %= mod;
    }
    y = (y * y);
    if (y > mod) y %= mod;
    b /= 2;
  }
  return x;
}
long long modInverse(long long a, long long m) { return pow(a, m - 2, m); }
long long mod = 1e9 + 7;
int arr[(int)1e6 + 1], brr[(int)1e6 + 1];
int main() {
  long long n, m;
  while (cin >> n) {
    map<int, int> mmap;
    for (int i = 0; i < n; i++) {
      int t;
      scanf("%d", &t);
      mmap[t]++;
    }
    cin >> m;
    for (int i = 0; i < m; i++) {
      scanf("%d", &arr[i]);
    }
    for (int i = 0; i < m; i++) {
      scanf("%d", &brr[i]);
    }
    vector<int> v;
    int maxi = 0;
    for (int i = 0; i < m; i++) {
      if (mmap[arr[i]] >= maxi) {
        maxi = mmap[arr[i]];
      }
    }
    for (int i = 0; i < m; i++) {
      if (mmap[arr[i]] == maxi) {
        v.push_back(i);
      }
    }
    maxi = 0;
    int ans = 0;
    for (int i = 0; i < v.size(); i++) {
      if (mmap[brr[v[i]]] >= maxi) {
        maxi = mmap[brr[v[i]]];
        ans = v[i];
      }
    }
    cout << ans + 1 << endl;
  }
}
