#include <bits/stdc++.h>
int cmpfunc(const void *a, const void *b) { return (*(int *)a - *(int *)b); }
int binarySearch(int arr[], int l, int r, int x) {
  if (r >= l) {
    int mid = l + (r - l) / 2;
    if (arr[mid] == x) return mid;
    if (arr[mid] > x) return binarySearch(arr, l, mid - 1, x);
    return binarySearch(arr, mid + 1, r, x);
  }
  return -1;
}
int a[200005], b[200005], maxi[200005], count[200005], pre1[200005],
    pre2[200005];
int main() {
  int n, i, j, k, max, maxi1, m, index;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    count[i] = 0;
  }
  qsort(a, n, sizeof(int), cmpfunc);
  j = 1;
  b[0] = a[0];
  count[0] = 1;
  for (i = 1; i < n; i++) {
    if (a[i] != a[i - 1]) {
      b[j++] = a[i];
      count[j - 1]++;
    } else {
      count[j - 1]++;
    }
  }
  j--;
  scanf("%d", &m);
  for (i = 0; i < m; i++) {
    scanf("%d", &pre1[i]);
  }
  for (i = 0; i < m; i++) {
    scanf("%d", &pre2[i]);
  }
  max = -1;
  k = 0;
  for (i = 0; i < m; i++) {
    index = binarySearch(b, 0, j, pre1[i]);
    if (index != -1) {
      if (count[index] > max) {
        max = count[index];
        k = 0;
        maxi[k++] = i;
      } else if (count[index] == max) {
        maxi[k++] = i;
      }
    }
  }
  max = -1;
  if (k == 0) {
    for (i = 0; i < m; i++) {
      maxi[i] = i;
      k = m;
    }
  }
  if (k == 1) {
    printf("%d\n", maxi[0] + 1);
  } else {
    for (i = 0; i < k; i++) {
      index = binarySearch(b, 0, j, pre2[maxi[i]]);
      if (index != -1) {
        if (count[index] > max) {
          max = count[index];
          maxi1 = maxi[i];
        }
      }
    }
    if (max == -1) {
      printf("%d\n", maxi[0] + 1);
    } else {
      printf("%d\n", maxi1 + 1);
    }
  }
  return 0;
}
