#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int ar[200005];
int br[200005];
int main() {
  int mxa = 0, mxb = 0, ind = 1;
  int n, m, d, a, b;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> d;
    mp[d]++;
  }
  cin >> m;
  for (int i = 0; i < m; i++) cin >> ar[i];
  for (int i = 0; i < m; i++) cin >> br[i];
  for (int i = 0; i < m; i++) {
    a = ar[i];
    b = br[i];
    if (mp[a] > mxa) {
      mxb = mp[b];
      mxa = mp[a];
      ind = i + 1;
    } else if (mp[a] == mxa) {
      if (mp[b] > mxb) {
        mxb = mp[b];
        ind = i + 1;
      }
    }
  }
  cout << ind << endl;
  return 0;
}
