#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n;
  map<long, long> map1;
  int x;
  int y = 0;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x == 218523525) y = 1;
    map1[x]++;
  }
  int m;
  cin >> m;
  int b[m], c[m], max = 0, min = 0, count = 0;
  for (int i = 0; i < m; i++) cin >> b[i];
  for (int i = 0; i < m; i++) cin >> c[i];
  for (int i = 0; i < m; i++) {
    if (map1[b[i]] > max) {
      count = i;
      max = map1[b[i]];
    } else if (map1[b[i]] == max) {
      if (map1[c[count]] < map1[c[i]]) count = i;
    }
  }
  cout << count + 1 << endl;
  return 0;
}
