Moscow is hosting a major international conference, which is attended by n scientists from different countries. Each of the scientists knows exactly one language. For convenience, we enumerate all languages of the world with integers from 1 to 10^9.

In the evening after the conference, all n scientists decided to go to the cinema. There are m movies in the cinema they came to. Each of the movies is characterized by two distinct numbers — the index of audio language and the index of subtitles language. The scientist, who came to the movie, will be very pleased if he knows the audio language of the movie, will be almost satisfied if he knows the language of subtitles and will be not satisfied if he does not know neither one nor the other (note that the audio language and the subtitles language for each movie are always different). 

Scientists decided to go together to the same movie. You have to help them choose the movie, such that the number of very pleased scientists is maximum possible. If there are several such movies, select among them one that will maximize the number of almost satisfied scientists.


-----Input-----

The first line of the input contains a positive integer n (1 ≤ n ≤ 200 000) — the number of scientists.

The second line contains n positive integers a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ 10^9), where a_{i} is the index of a language, which the i-th scientist knows.

The third line contains a positive integer m (1 ≤ m ≤ 200 000) — the number of movies in the cinema. 

The fourth line contains m positive integers b_1, b_2, ..., b_{m} (1 ≤ b_{j} ≤ 10^9), where b_{j} is the index of the audio language of the j-th movie.

The fifth line contains m positive integers c_1, c_2, ..., c_{m} (1 ≤ c_{j} ≤ 10^9), where c_{j} is the index of subtitles language of the j-th movie.

It is guaranteed that audio languages and subtitles language are different for each movie, that is b_{j} ≠ c_{j}. 


-----Output-----

Print the single integer — the index of a movie to which scientists should go. After viewing this movie the number of very pleased scientists should be maximum possible. If in the cinema there are several such movies, you need to choose among them one, after viewing which there will be the maximum possible number of almost satisfied scientists. 

If there are several possible answers print any of them.


-----Examples-----
Input
3
2 3 2
2
3 2
2 3

Output
2

Input
6
6 3 1 1 3 7
5
1 2 3 4 5
2 3 4 5 1

Output
1



-----Note-----

In the first sample, scientists must go to the movie with the index 2, as in such case the 1-th and the 3-rd scientists will be very pleased and the 2-nd scientist will be almost satisfied.

In the second test case scientists can go either to the movie with the index 1 or the index 3. After viewing any of these movies exactly two scientists will be very pleased and all the others will be not satisfied.

Difficulty: interview

Starter code:

Solutions:
n = int(input())
L = list(map(int, input().split()))
m = int(input())
A = list(map(int, input().split()))
S = list(map(int, input().split()))

D = {}
for i in range(n):
    if L[i] in list(D.keys()):
        D[L[i]] += 1
    else:
        D[L[i]] = 1
M = [[0,0,i+1] for i in range(m)]
for i in range(m):
    if A[i] in list(D.keys()):
        M[i][0] += D[A[i]]
    if S[i] in list(D.keys()):
        M[i][1] += D[S[i]]

def ct(a):
    return a[0],a[1]

M.sort(key=ct,reverse=True)
print(M[0][2])


#!/usr/bin/env python3

from collections import Counter

try:
    while True:
        langs = Counter()
        input()
        for i in input().split():
            langs[int(i)] += 1

        input()
        b = list(map(int, input().split()))
        c = list(map(int, input().split()))
        result = (0, 0)
        result_index = 1
        for i, (x, y) in enumerate(zip(b, c), 1):
            t = (langs[x], langs[y])
            if t > result:
                result = t
                result_index = i

        print(result_index)

except EOFError:
    pass


from collections import Counter
n = int(input())
a = list(map(int, input().split()))

freq = Counter(a)

m = int(input())
b = list(map(int, input().split()))
c = list(map(int, input().split()))

best_index = 1
best_score = (0, 0)

for i in range(m):
    vs = freq[b[i]]
    als = freq[c[i]]
    if vs > best_score[0] or (vs == best_score[0] and als > best_score[1]):
        best_index = i + 1
        best_score = (vs, als)

print(best_index)


n = int(input())
s = list(map(lambda x: int(x), input().split()))
a = {}
for i in range(n):
	if s[i] in a:
		a[s[i]] += 1
	else:
		a[s[i]] = 1

m = int(input())

b = list(map(lambda x: int(x), input().split()))
c = list(map(lambda x: int(x), input().split()))

ans = -1
d = -1
pd = -1

for i in range(m):
	if b[i] in a:
		cd = a[b[i]]
	else:
		cd = 0
		
	if c[i] in a:
		cpd = a[c[i]]
	else:
		cpd = 0
		
	if (cd > d) or (cd == d and cpd > pd):
		ans = i
		d = cd
		pd = cpd
		
print(ans + 1)

read = lambda: list(map(int, input().split()))
n = int(input())
a = list(read())
m = int(input())
b = list(read())
c = list(read())
from collections import Counter as C
d = C()
for i in a:
    d[i] += 1
mb = mc = -1
ind = -1
for i in range(m):
    if d[b[i]] > mb:
        mb = d[b[i]]
        mc = d[c[i]]
        ind = i + 1
    elif d[b[i]] == mb and d[c[i]] > mc:
        mc = d[c[i]]
        ind = i + 1
print(ind)


from sys import stdin, stdout
n = int(stdin.readline())
d = {}
languages = list(map(int, stdin.readline().split()))
for l in languages:
    if l not in d:
        d[l] = 1
    else:
        d[l] += 1
m = int(stdin.readline())
movies = []
voice = list(map(int, stdin.readline().split()))

for i in range(m):
    if voice[i] in d:
        movies.append([d[voice[i]], 0, i])
    else:
        movies.append([0, 0, i])
subtitles = list(map(int, stdin.readline().split()))
for i in range(m):
    if subtitles[i] in d:
        movies[i][1] = d[subtitles[i]]
stdout.write(str(sorted(movies)[-1][-1] + 1))

n = int(input())
a = list(map(int, input().split()))
lang = dict()
cnt = [0]*n
count = 0
for l in a:
    if l not in lang:
        lang[l] = count
        count += 1
    cnt[lang[l]]+=1
    
m = int(input())
b = list(map(int, input().split()))
c = list(map(int, input().split()))

bestfilm = 0
bestsat = 0 if b[0] not in lang else cnt[lang[b[0]]]
bestpartsat = 0 if c[0] not in lang else cnt[lang[c[0]]]
for i in range(m):
    sat = 0 if b[i] not in lang else cnt[lang[b[i]]]
    partsat = 0 if c[i] not in lang else cnt[lang[c[i]]]
    if (sat > bestsat) or (sat == bestsat and bestpartsat<partsat):
        bestfilm = i
        bestsat = sat
        bestpartsat = partsat
print(bestfilm+1)


n=int(input())
slov={}
mas=list(map(int, input().split()))
mas.sort()
kek={}
i=1
for b in range(1, n):
    if mas[b]==mas[b-1]:
        i+=1
    else:
        kek[mas[b-1]]=i
        i=1
kek[mas[n-1]]=i
m=int(input())
mas=list(map(int, input().split()))
mas2=list(map(int, input().split()))
mi1=-1
mi2=-1
otv=0
for i in range(m):
    try:
        a=kek[mas[i]]
    except:
        a=0
    try:
        b=kek[mas2[i]]
    except:
        b=0
    if a>mi1:
        mi1=a
        mi2=b
        otv=i+1
    elif a==mi1:
        if mi2<b:
            mi2=b
            otv=i+1
print(otv)

import sys
import math
import itertools as it
import operator as op
import fractions as fr


n = int(sys.stdin.readline().strip())
A = list(map(int, sys.stdin.readline().split()))
m = int(sys.stdin.readline().strip())
B = list(map(int, sys.stdin.readline().split()))
C = list(map(int, sys.stdin.readline().split()))

D = dict()
D.update(list(zip(A, [0]*len(A))))
D.update(list(zip(B, [0]*len(B))))
D.update(list(zip(C, [0]*len(C))))

for a in A:
  D[a] += 1

max_val = -1
l = []
for idx in range(len(B)):
  b = B[idx]
  if D[b] > max_val:
    max_val = D[b]
    l = [idx]
  elif D[b] == max_val:
    l.append(idx)

max_idx = 0
max_val = -1
for idx in l:
  c = C[idx]
  if D[c] > max_val:
    max_val = D[c]
    max_idx = idx

print(max_idx+1)


from collections import Counter

n = int(input())
lang = Counter(list(map(int, input().split())))

m = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

res = list()

for i in range(m):
	res.append((lang[a[i]], lang[b[i]], i))

print(sorted(sorted(res, key = lambda x: x[1], reverse = True), key = lambda x: x[0], reverse = True)[0][2] + 1)

n = int(input())

languages = {}
s = input().split()
for i in s:
	if i in languages:
		languages[i] += 1
	else:
		languages[i] = 1

m = int(input())
audio = input().split()
subtitles = input().split()

bestm = 1
besta = 0
bests = 0
for i in range(m):
	ad = audio[i]
	sb = subtitles[i]
	ac = 0
	if ad in languages:
		ac = languages[ad]
	sc = 0
	if sb in languages:
		sc = languages[sb]
	if ac > besta or ac == besta and sc > bests:
		bestm = i + 1
		besta = ac
		bests = sc

print(bestm)

n=int(input())
l=sorted(map(int,input().split()))
m=int(input())
b=list(map(int,input().split()))
c=list(map(int,input().split()))
d={}
for x in l:
    d[x]=d.get(x,0)+1
ans=(0,0,0)
for i in range(m):
    cob=d.get(b[i],0)
    coc=d.get(c[i],0)
    if cob>ans[1]: ans=(i,cob,coc)
    if cob==ans[1] and coc>ans[2]: ans=(i,cob,coc)
print(ans[0]+1)

n = int(input())
men = list(map(int,input().split()))
d = dict()
for i in men:
    now = d.get(i,0)
    d[i] = now+1
m = int(input())
f1 = list(map(int,input().split()))
f2 = list(map(int,input().split()))
mx = 0
mx2 = 0
num = 0
for i in range(m):
    now = d.get(f1[i],0)
    if now>mx:
        mx = now
        mx2 = d.get(f2[i],0)
        num = i
    elif now == mx:
        now2 = d.get(f2[i],0)
        if now2>mx2:
            mx2 = d.get(f2[i],0)
            num = i            
print(num+1)

def which_movie(n, m, langs_ix, audio_ix, subs_ix):
    langs = {}
    for l in langs_ix:
        if l in langs:
            langs[l] += 1
        else:
            langs[l] = 1
    scores = []
    for i in range(m):
        vp = langs[audio_ix[i]] if audio_ix[i] in langs else 0
        asp = langs[subs_ix[i]] if subs_ix[i] in langs else 0
        scores.append((i + 1, vp, asp))

    scores = sorted(scores, key=lambda x: (x[1], x[2], -x[0]))
    return scores[-1][0]


def main():
    n = int(input().strip())
    lang_ix = [int(i) for i in input().strip().split()]
    m = int(input().strip())
    audiolang_ix = [int(i) for i in input().strip().split()]
    subtitle_ix = [int(i) for i in input().strip().split()]
    ans = which_movie(n, m, lang_ix, audiolang_ix, subtitle_ix)
    print(ans)


def __starting_point():
    main()

__starting_point()

n = int(input())
s = [int(i) for i in input().split()]
m = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
d = dict()
r = []
for i in s:
	if i in d:
		d[i]+=1
	else:
		d[i] = 1
for i in a:
	if i not in d:
		d[i] = 0
for i in b:
	if i not in d:
		d[i] = 0
films = []
for i in range(m):
	films.append((i+1, (d[a[i]], d[b[i]])))
films.sort(key=lambda i: i[1], reverse = True)
print(films[0][0])

	


import sys, math

n = int(input())
uch = list(map(int, sys.stdin.readline().split()))
dic = dict()
for x in uch:
    if (x in list(dic.keys())):
        dic[x] += 1
    else:
        dic[x] = 1
m = int(input())
langf = list(map(int, sys.stdin.readline().split()))
subf = list(map(int, sys.stdin.readline().split()))
maxl = 0
maxs = 0
ans = 1
for i in range(m):
    if (langf[i] not in list(dic.keys())):
        dic[langf[i]] = 0
    if (subf[i] not in list(dic.keys())):
        dic[subf[i]] = 0
    if (maxl < dic[langf[i]]):
        maxl = dic[langf[i]]
        maxs = dic[subf[i]]
        ans = i+1
    elif (maxl == dic[langf[i]]) and (maxs < dic[subf[i]]):
        maxs = dic[subf[i]]
        ans = i+1
print(ans)


n = int(input())
lang_cnt = {}
for lang in input().split():
    if lang not in lang_cnt:
        lang_cnt[lang] = 0
    lang_cnt[lang] += 1
m = int(input())
best_vp_cnt = -1
best_as_cnt = -1
best_movie = 0
audio = input().split()
subtitles = input().split()
for i in range(1, m + 1):
    vp_cnt = lang_cnt.get(audio[i - 1], 0)
    as_cnt = lang_cnt.get(subtitles[i - 1], 0)
    if vp_cnt > best_vp_cnt:
        best_vp_cnt = vp_cnt
        best_as_cnt = as_cnt
        best_movie = i
    elif vp_cnt == best_vp_cnt and as_cnt > best_as_cnt:
        best_vp_cnt = vp_cnt
        best_as_cnt = as_cnt
        best_movie = i
print(best_movie)


n = int(input())
A = list(map(int, input().split()))

m = int(input())
B = list(map(int, input().split()))
C = list(map(int, input().split()))

D = dict()
for a in A :
    if a not in D :
        D[a] = 1
    else :
        D[a] += 1

P = [0] * m
S = [0] * m
for i in range(m) :
    key = B[i]
    if key in D :
        P[i] += D[key]
for i in range(m) :
    key = C[i]
    if key in D :
        S[i] += D[key]

ans = 0
for i in range(1, m) :
    if P[i] > P[ans] or (P[i] == P[ans] and S[i] > S[ans]) :
        ans = i

ans += 1
print(ans)

parse_int = lambda: list(map(int, input().split()))

scientists = int(input())
sc_langs = parse_int()
films = int(input())
film_voice = parse_int()
film_sub = parse_int()

#print(film_voice)
#print(film_sub)

#ppl_in_lang = [0]*(10**9+5)
lang_decoder = dict()
lang_decoder.setdefault(0)

for _ in sc_langs:
    if _ in list(lang_decoder.keys()):
        lang_decoder[_]+=1
    else:
        lang_decoder[_]=1

#print( lang_decoder)

film_good, film_ok = [0]*films, [0]*films

for _ in range(films):
    try:
        film_good[_] += (lang_decoder[film_voice[_]] or 0)
    except KeyError:
        pass

    try:
        film_ok[_]   += (lang_decoder[film_sub[_]  ] or 0)
    except KeyError:
        pass

best = 0
for _ in range(films):
    if film_good[_] > film_good[best]: best = _
    if (film_good[_] == film_good[best]) \
        and (film_ok[_] > film_ok[best]): best = _

#print(film_good)
#print(film_ok)

print(best+1)