#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i;
  scanf("%d", &n);
  map<long int, int> sci;
  long int t2, t1;
  for (i = 0; i < n; i++) {
    scanf("%ld", &t2);
    sci[t2]++;
  }
  scanf("%d", &n);
  int sat[n], asat[n];
  for (i = 0; i < n; i++) {
    scanf("%ld", &t1);
    sat[i] = sci[t1];
  }
  for (i = 0; i < n; i++) {
    scanf("%ld", &t2);
    asat[i] = sci[t2];
  }
  int maxs = 0;
  for (i = 0; i < n; i++) {
    if (sat[i] > maxs) maxs = sat[i];
  }
  int p = 0;
  vector<int> mov;
  for (i = 0; i < n; i++) {
    if (sat[i] == maxs) {
      mov.push_back(i);
      p++;
    }
  }
  int ans;
  maxs = -1;
  for (i = 0; i < p; i++) {
    if (asat[mov[i]] > maxs) {
      maxs = asat[mov[i]];
      ans = mov[i] + 1;
    }
  }
  printf("%d", ans);
  return 0;
}
