#include <bits/stdc++.h>
using namespace std;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
int dx2[] = {1, -1, -1, 1, 0, 0, -1, 1};
int dy2[] = {1, -1, 1, -1, 1, -1, 0, 0};
int kmx[] = {-1, -1, 1, 1, 2, -2, 2, -2};
int kmy[] = {2, -2, 2, -2, -1, -1, 1, 1};
class Timer {
 public:
  clock_t T;
  Timer() { T = clock(); }
  ~Timer() {
    fprintf(stderr, "\n%.3f\n", double(clock() - T) / CLOCKS_PER_SEC);
  }
};
int read() {
  int x;
  scanf("%d", &x);
  return x;
}
const int N = 2e5;
int n, a[N], m, b[N], c[N];
map<int, int> Map;
int main() {
  n = read();
  for (int i = 0; i < n; i++) {
    a[i] = read();
    Map[a[i]]++;
  }
  m = read();
  for (int i = 0; i < m; i++) b[i] = read();
  for (int i = 0; i < m; i++) c[i] = read();
  int ans = 0;
  int m1, m2;
  m1 = m2 = -1;
  for (int i = 0; i < m; i++) {
    if (Map[b[i]] > m1) m1 = Map[b[i]], ans = i;
  }
  for (int i = 0; i < m; i++) {
    if (Map[b[i]] == m1 && Map[c[i]] > m2) m2 = Map[c[i]], ans = i;
  }
  cout << ans + 1 << endl;
  return 0;
}
