Solve in Python:
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...
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))