import collections
n = int(input())
c = collections.Counter(list(map(int, input().split())))
k = 3*10**5
ans = -1
curS = -1
m = int(input())
y = list(map(int, input().split()))
z = list(map(int, input().split()))
for i in range(m):
if c[y[i]] * k + c[z[i]] > curS:
ans = i
curS = c[y[i]] * k + c[z[i]]
print(ans + 1)