Little Egor is a huge movie fan. He likes watching different kinds of movies: from drama movies to comedy movies, from teen movies to horror movies. He is planning to visit cinema this weekend, but he's not sure which movie he should watch.
There are n movies to watch during this weekend. Each movie can be characterized by two integers Li and Ri, denoting the length and the rating of the corresponding movie. Egor wants to watch exactly one movie with the maximal value of Li × Ri. If there are several such movies, he would pick a one with the maximal Ri among them. If there is still a tie, he would pick the one with the minimal index among them.
Your task is to help Egor to pick a movie to watch during this weekend.

-----Input-----
The first line of the input contains an integer T denoting the number of test cases.
The first line of the test case description contains an integer n.
The second line of the test case description contains n integers L1, L2, ...,Ln. The following line contains n integers R1, R2, ..., Rn.

-----Output-----
For each test case, output a single integer i denoting the index of the movie that Egor should watch during this weekend. Note that we follow 1-based indexing.

-----Constraints-----
- 1 ≤ T ≤ 5
- 1 ≤ n ≤ 100
- 1 ≤ Li, Ri ≤ 100

-----Example-----
Input:
2
2
1 2
2 1
4
2 1 4 1
2 4 1 4

Output:
1
2

-----Explanation-----
In the first example case, both films have the same value of L × R, but the first film has a better rating.
In the second example case, the second and the fourth movies are equally good, but the second movie has a smaller index.

Starter code:

Solutions:
def bestMovie():
 tests=int(input())
 for t in range(tests):
  n = int(input())
  L = list(map(int, input().split()))
  R = list(map(int, input().split()))
  maxIndex = -1
  maxValue = 0
  for i in range(n):
   prod = L[i]*R[i]
   if maxValue < prod:
    maxValue = prod
    maxIndex = i
   elif maxValue == prod:
    if R[maxIndex] < R[i]:
     maxIndex = i
  print(maxIndex+1)

bestMovie()

__author__ = 'Hacktivist'

test = int(input())
for testCases in range(test):
 n = int(input())
 l = list(map(int, input().split()))
 r = list(map(int, input().split()))
 hackmul = 0
 hackIndex = 0
 hackFound = False
 for item in range(len(l)):
  hackVar = l[item]*r[item]
  if hackVar > hackmul:
   hackmul = l[item]*r[item]
   hackIndex = item
   hackVar = 0
  if hackVar == hackmul:
   hackFound = True
 if hackFound:
  print(r.index(max(r)) + 1)
 else:
  print(hackIndex + 1)

# cook your code here
for tests in range(eval(input())):
 n = eval(input())
 L = list(map(int,input().split()))
 R = list(map(int,input().split()))
 
 pro = 0
 index = 0
 tmp = 1
 r = 0
 for i in range(n):
  tmp = L[i]*R[i]
  
  if(tmp>pro):
   pro = tmp
   index = i+1
  if(tmp==pro):
   if(R[i]>r):
    index = i+1
    r = R[i]
 print(index)

t = int(input())

for e in range(t):

 n = int(input())
 l_str = input()
 r_str = input()

 l_str = l_str.strip().split(" ")
 r_str = r_str.strip().split(" ")

 lr_str = []
 for x in range(n):
  lr_str.append(int(l_str[x]) * int(r_str[x]))

 lr_max = 0
 maxIndex = 0
 for x in range(n):
  if int(lr_str[x]) > lr_max:
   lr_max = lr_str[x]
   maxIndex = x

 max_r = 0
 for x in range(n):
  if int(lr_str[x]) == lr_max:
   if int(r_str[x]) > max_r:
    max_r = int(r_str[x])
    maxIndex = x

 max_i = 0
 for x in range(n):
  if int(lr_str[x]) == lr_max:
   if int(r_str[x]) == max_r:
    print(x + 1)
    break

t = int(input())

for e in range(t):

 n = int(input())
 l_str = input()
 r_str = input()

 l_str = l_str.strip().split(" ")
 r_str = r_str.strip().split(" ")

 max_p = 0
 for i in range(len(l_str)):
  if int(l_str[i]) * int(r_str[i]) > max_p:
   max_p = int(l_str[i]) * int(r_str[i])

 max_r = 0
 for i in range(len(l_str)):
  if int(l_str[i]) * int(r_str[i]) >= max_p:
   if int(r_str[i]) > max_r:
    max_r = int(r_str[i])

 for i in range(len(l_str)):
  if int(l_str[i]) * int(r_str[i]) >= max_p and int(r_str[i]) >= max_r:
   print(i + 1)
   break

# MOVIEWKN.py

t = int(input())
for _ in range(t):
 n = int(input())
 a = list(map(int,input().split()))
 b = list(map(int,input().split()))
 m = 0;
 for i in range(n):
  m = max(m,a[i]*b[i])
 ans = -1;
 r = 0;
 for i in range(n):
  if m == a[i]*b[i]:
   if r < b[i]:
    ans = i;
    r = b[i];
 print(ans+1);

# your code goes here
for _ in range(eval(input())):
 n=eval(input())
 l=list(map(int,input().split()))
 r=list(map(int,input().split()))
 max1,index,rc=0,0,0
 for i in range(len(l)):
  temp=l[i]*r[i]
  if(max1<temp or (max1==temp and r[i]>rc)):
   max1=temp
   rc=r[i]
   index=i
 print(index+1)


import sys

def main():
 t=int(input())
 for z in range(t):
  movie=int(input())
  leng=[]
  rating=[]
  opt=[]
  leng=list(map(int, input().split()))
  rating=list(map(int, input().split()))

  i=0
  opt.append(leng[i]*rating[i])
  
  index=i
  rate=rating[i]
  value=opt[i]
  
  
  for i in range(1, movie):
   opt.append(leng[i]*rating[i])
   
   if opt[i]>value:
    value=opt[i]
    rate=rating[i]
    index=i
   elif opt[i]==value:
    if rating[i]>rate:
     value=opt[i]
     rate=rating[i]
     index=i
  print(index+1)
main()
   


for _ in range(eval(input())):
 n = eval(input())
 l = list(map(int, input().split()))
 r = list(map(int, input().split()))
 max,rat,ind = l[0] * r[0],r[0], 1
 for i in range(1,n):
  if l[i]*r[i] >= max:
   if rat < r[i]:
    max = l[i]*r[i]
    ind = i+1
    rat = r[i]
 print(ind)

# -*- coding: utf-8 -*-
"""
Created on Sun Apr 17 21:28:56 2016

@author: Harry
"""
import collections
no_of_testcases = int(input())
for each in range(no_of_testcases):
 to_watch = []
 length = []
 rating = []
 no_of_movies = int(input())
 length = list(map(int,input().split()))
 rating = list(map(int,input().split()))
 for e in range(no_of_movies):
  l_x_r = length[e]*rating[e]
  to_watch.append(l_x_r)
 counter = collections.Counter(to_watch)
 test = max(counter.keys())
 if counter[test] > 1:
  rating_indexes = [0]
  i = 0
  for x in to_watch:
   if x == test:
    if rating[i] > rating_indexes[0]:
     high_ratng = rating[i]
     rating_indexes = [high_ratng]
   i = i+1
  print(rating.index(high_ratng) +1)
 else:
  print(to_watch.index(test)+1)
   
  


def find_movie(T,R):
 e = []
 for d in range(len(T)):
  f = [] 
  f.append(int(T[d])*int(R[d]))
  f.append(int(R[d]))
  f.append(int(T[d]))
  e.append(f)
 max_val = []
 max_val = max(e)
 index = e.index(max_val)
 return (index+1) 
 
t = int(input())
for x in range(t):
 n = int(input())
 timing = []
 timing = str(input())
 timing = timing.split()
 rating = []
 rating = str(input())
 rating = rating.split()
 index = find_movie(timing,rating)
 print(index)
 


for i in range(int(input())):
 n=int(input())
 a=list(map(int,input().split()))
 b=list(map(int,input().split()))
 c=[]
 for j in range(len(a)):
  c.append(a[j]*b[j])
 #print c.index(max(c))
 mx=max(c)
 ndx=[]
 temp=[]
 for j in range(len(c)):
  if c[j]==mx:
   ndx.append(j)
 for j in ndx:
  temp.append(b[j])
 print(b.index(max(temp))+1)


t=int(input())
for i in range(t):
 n=int(input())
 l=list(map(int,input().split()))
 r=list(map(int,input().split()))
 maxv=-1
 for i in range(n):
  a=l[i]*r[i]
  if a >= maxv:
   if a==maxv:
    if prevr < r[i]:
     index=i
     prevr=r[i]
   else:
    index=i
    prevr=r[i]
    maxv=a
 print(index+1)


for t in range(eval(input())):
 n = eval(input())
 l = list(map(int, input().split()))
 r = list(map(int, input().split()))
 lr = []
 for i in range(n):
  lr.append(l[i]* r[i])
 maxim = max(lr)
 index = -1
 maxR = -1
 for i, value in enumerate(lr):
  if maxim == value :
   if maxR < r[i]:
    maxR = r[i]
    index = i

 print(index+1)

T=int(input())
for i in range(T):
 N=int(input())
 l=list(map(int,input().split()))
 r=list(map(int,input().split()))
 maxi=0
 index_min=0
 ratmax=0
 for j in range(N):
  prod=l[j]*r[j]
  if(prod>maxi):
   maxi=prod
   index_min=j
   ratmax=r[j]
  elif(prod==maxi):
   if(r[j]>ratmax):
    ratmax=r[j]
    index_min=j
 print(index_min+1)

for _ in range(int(input())):
 n=int(input())
 L=list(map(int,input().split()))
 R=list(map(int,input().split()))
 pos=0
 Rmax=R[0]
 maxx=0
 for i in range(n):
  temp=L[i]*R[i]
  
  if temp>maxx:
   maxx=temp
   Rmax=R[i]
   pos=i
   
  elif temp==maxx:
   if R[i]>Rmax:
    Rmax=R[i]
    pos=i
 print(pos+1)
     
     
  


t = int(input())
while t:
 n = int(input())
 l = list(map(int, input().split()))
 r = list(map(int, input().split()))
 i = 0
 m = 1
 LR = [0,0]
 I = 0
 while i<n:
  if l[i] * r[i] > m:
   m = l[i] * r[i]
   LR = [l[i],r[i]]
   I = i
  elif LR[1] < r[i] and l[i] * r[i] == m:
   m = l[i] * r[i]
   LR = [l[i],r[i]]
   I = i
  i += 1
 print(I+1)
 t -= 1
  



t=eval(input())
for i in range(t):
 big=[0,0]
 n=eval(input())
 a=list(map(int,input().strip().split(' ')))
 b=list(map(int,input().strip().split(' ')))
 for k in range(n):
  if a[k]*b[k]>big[0]:
   big[0]=a[k]*b[k]
   big[1]=b[k]
   c=k+1
  elif a[k]*b[k]==big[0]:
   if big[1]<b[k]:
    c=k+1
    big[1]=b[k]
 print(c)

t = int(input())
for test in range(t):
 n = int(input())
 l = list(map(int,input().split()))
 r = list(map(int,input().split()))
 m = -1
 rv = -1
 t = -1
 for x in range(n):
  if t < l[x]*r[x]:
   m = x+1
   t = l[x]*r[x]
   rv = r[x]
  elif t == l[x]*r[x]:
   if rv < r[x]:
    m = x+1
    t = l[x]*r[x]
    rv = r[x]
 print(m)