In this problem we consider a special type of an auction, which is called the second-price auction. As in regular auction n bidders place a bid which is price a bidder ready to pay. The auction is closed, that is, each bidder secretly informs the organizer of the auction price he is willing to pay. After that, the auction winner is the participant who offered the highest price. However, he pay not the price he offers, but the highest price among the offers of other participants (hence the name: the second-price auction).

Write a program that reads prices offered by bidders and finds the winner and the price he will pay. Consider that all of the offered prices are different.


-----Input-----

The first line of the input contains n (2 ≤ n ≤ 1000) — number of bidders. The second line contains n distinct integer numbers p_1, p_2, ... p_{n}, separated by single spaces (1 ≤ p_{i} ≤ 10000), where p_{i} stands for the price offered by the i-th bidder.


-----Output-----

The single output line should contain two integers: index of the winner and the price he will pay. Indices are 1-based.


-----Examples-----
Input
2
5 7

Output
2 5

Input
3
10 2 8

Output
1 8

Input
6
3 8 2 9 4 14

Output
6 9

Difficulty: EASY

Solutions:
n = int(input())
l = list(map(int, input().split()))
dic = {}
for i in range(n):
	a = l[:]
	a.pop(i)
	dic[i + 1] = max(a)
c = list(dic.values())
c = list(set(c))
c.remove(max(c))
m = max(c)
for i in dic:
	if dic[i] == m:
		k = i
print(k, m)


import sys
import math
import itertools
import collections

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = prime[1] = False
	r = [p for p in range(n + 1) if prime[p]]
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ''.join(map(str, arr))

def revn(n):
	return str(n)[::-1]

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base=3):
	newnumber = ''
	while number > 0:
		newnumber = str(number % base) + newnumber
		number //= base
	return newnumber
n = ii()
p = li()
ans = p.index(max(p)) + 1
p.sort()
print(ans, p[-2])


n = int(input())
p = list(map(int, input().split()))
hi = p[:p.index(max(p))] + p[p.index(max(p)) + 1:]
print(p.index(max(p)) + 1, end=' ')
print(max(hi))


n = int(input())
l = list(map(int, input().split()))
i = l.index(max(l)) + 1
l.remove(max(l))
print(i, max(l))


n = int(input())
l = list(map(int, input().split()))
l1 = l.copy()
s = list(set(l))
s.sort(reverse=True)
print(l1.index(s[0]) + 1, s[1])


(n, p) = (int(input()), sorted(((x, i) for (i, x) in enumerate(map(int, input().split())))))
print(p[-1][1] + 1, p[-2][0])


n = int(input())
a = list(map(int, input().split()))
m = max(a)
res = a.index(m)
a.remove(m)
r = max(a)
print(res + 1, r)


n = int(input())
p = list(map(int, input().split()))
a = p.index(max(p)) + 1
p.remove(max(p))
b = max(p)
print(a, b)


n = int(input())
prices = [int(i) for i in input().split()]
people = []
for i in range(n):
	people.append([i + 1, prices[i]])
people.sort(key=lambda x: x[1])
print(str(people[-1][0]) + ' ' + str(people[-2][1]))


n = int(input())
l = list(map(int, input().split()))
p = l.copy()
p.sort()
i = l.index(max(p)) + 1
j = p[-2]
print(i, j)


__author__ = 'Administrator'
n = int(input())
test = []
test1 = []
test = list(map(int, input().split()))
i = 1
for value in test:
	test1.append((value, i))
	i += 1
test1.sort(key=lambda d: d[0], reverse=True)
print(test1[0][1], test1[1][0])


n = int(input())
a = list(map(int, input().split()))
z = a.index(max(a)) + 1
a.sort()
print(z, a[-2])


import sys
input = sys.stdin.buffer.readline
n = int(input())
arr = list(map(int, input().split()))
pos = arr.index(max(arr)) + 1
arr.sort(reverse=True)
print(pos, arr[1])


n = int(input())
prices = input().split(' ')
for (c, price) in enumerate(prices):
	prices[c] = int(price)
result = str(prices.index(max(prices)) + 1) + ' ' + str(sorted(prices, reverse=True)[1])
print(result)


n = int(input())
numstr = input()
lis = numstr.split()
i = 0
while i < n:
	lis[i] = int(lis[i])
	i += 1
lis2 = lis.copy()
lis2.sort()
lis2.reverse()
print(lis.index(max(lis)) + 1, lis2[1])


n = int(input())
arr = list(map(int, input().split()))
max = 0
for i in range(1, n):
	if arr[max] < arr[i]:
		max = i
arr.sort()
print(max + 1, arr[-2])


read = lambda : list(map(int, input().split()))
n = int(input())
p = list(read())
Max = max(p)
ind = p.index(Max) + 1
p.remove(Max)
Max2 = max(p)
print(ind, Max2)


n = int(input())
l = list(map(int, input().split()))
m = []
for i in l:
	m.append(i)
m.sort()
p = m[len(m) - 1]
a1 = 0
for i in range(0, n):
	if l[i] == p:
		a1 = i
		break
print(a1 + 1, m[len(m) - 2])


n = int(input())
li = list(map(int, input().split()))
k = li.index(max(li))
li = set(li)
li = sorted(li, reverse=True)
b = li[1]
print(k + 1, b)


n = int(input())
p = list(map(int, input().split()))
maxi = max(p)
mas = 0
for x in range(len(p)):
	if mas < p[x] < maxi:
		mas = p[x]
print(p.index(maxi) + 1, mas)


n = int(input())
p = list(map(int, input().split()))
m = max(p)
l = p.index(m)
p = sorted(p)
print(l + 1, p[n - 2])


n = int(input())
l = list(map(int, input().split()))
m = l[0]
ind = 0
for i in range(1, n):
	if l[i] > m:
		m = l[i]
		ind = i
l.sort()
print(ind + 1, l[n - 2])


def find_max(l):
	maximum = l[0]
	ind_max = 0
	for i in range(len(l)):
		if maximum < l[i]:
			maximum = l[i]
			ind_max = i
	return ind_max

def main_function():
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	ind_max = find_max(a)
	a.pop(ind_max)
	second_ind_max = find_max(a)
	return f'{ind_max + 1} {a[second_ind_max]}'
print(main_function())


n = int(input())
array = list(map(int, input().split()))
array2 = []
for x in array:
	array2.append(x)
array.sort()
win = array[-2]
index = array2.index(array[-1]) + 1
print(index, win)


input()
p = list(enumerate(map(int, input().split()), 1))
p.sort(key=lambda i: i[1])
print(p[-1][0], p[-2][1])


n = int(input())
arr = list(map(int, input().split(' ')))
mx = max(arr)
win = arr.index(mx)
print(win + 1, end=' ')
arr[win] = 0
print(max(arr))


n = input()
n = int(n)
L = input().split()
for i in range(len(L)):
	L[i] = int(L[i])
bidder = L.index(max(L)) + 1
L.sort()
price = L[-2]
print(bidder, price)


input()
data = map(int, input().split())
a = next(data)
b = next(data)
if a > b:
	m1 = a
	mi1 = 1
	m2 = b
else:
	m1 = b
	mi1 = 2
	m2 = a
for (i, v) in enumerate(data):
	if v > m1:
		(m1, m2, mi1) = (v, m1, i + 3)
	elif v > m2:
		m2 = v
print(mi1, m2)


input()
X = list(map(int, input().split()))
print(X.index(sorted(X)[-1]) + 1, sorted(X)[-2])


fast = lambda : stdin.readline().strip()
zzz = lambda : [int(i) for i in fast().split()]
(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from re import *
from sys import *
from math import *
from heapq import *
from queue import *
from bisect import *
from string import *
from itertools import *
from collections import *
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from collections import Counter as cc
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer):
	stdout.write(str(answer))
z()
arr = zzz()
lst = []
for (i, j) in enumerate(arr):
	lst.append((j, i + 1))
lst = sorted(lst)[::-1]
print(lst[0][1], lst[1][0])


no_of_bidders = int(input())
bidder_price_list = []
bidder_price_list = list(map(int, input().strip().split()))[:no_of_bidders]
winner_index = 0
winner = 0
for i in range(no_of_bidders):
	if bidder_price_list[i] > winner:
		winner = bidder_price_list[i]
		winner_index = i
bidder_price_list.pop(winner_index)
second_price = max(bidder_price_list)
print(winner_index + 1, end=' ')
print(second_price, end=' ')


n = int(input())
p = sorted(enumerate(map(int, input().split())), key=lambda x: x[1])
print(p[-1][0] + 1, p[-2][1])


number = int(input())
list1 = list(map(int, input().split()))
greatest = max(list1)
index = 0
second = 0
for i in range(number):
	if list1[i] < greatest and list1[i] > second:
		second = list1[i]
	if list1[i] == greatest:
		index = i + 1
print(index, second)


n = int(input())
a = list(input().split())
mx = -1
mx2 = -1
pos = -1
for i in range(0, n):
	a[i] = int(a[i])
	if a[i] > mx:
		mx2 = mx
		pos = i + 1
		mx = a[i]
	elif a[i] > mx2:
		mx2 = a[i]
	i = i + 1
print(str(pos) + ' ' + str(mx2))


int1 = int(input())
list1 = list(map(int, input().strip().split()))
print(list1.index(max(list1)) + 1, end=' ')
list1.remove(max(list1))
print(max(list1))


n = int(input())
a = list(map(int, input().split()))
largest = max(a)
b = []
for i in range(n):
	if a[i] == max(a):
		winner = i + 1
for x in a:
	if x != largest:
		b.append(x)
print(winner, max(b))


x = int(input())
l = list(map(int, input().split()))
c = l.index(max(l)) + 1
l.remove(max(l))
print(c, max(l))


n = int(input())
s = list(map(int, input().split(' ')))
q = s.index(max(s)) + 1
s.sort()
print(q, end=' ')
print(s[n - 2])


n = int(input())
prices = list(map(int, input().split()))
pr = max(prices)
ind = prices.index(pr)
prices.remove(pr)
spesa = max(prices)
print(ind + 1, spesa)


n = int(input())
L = list(map(int, input().split()))
ind = L.index(max(L))
L.remove(max(L))
x = max(L)
print(ind + 1, x)


n = int(input())
arr = list(map(int, input().split()))
x = arr.index(max(arr))
arr.sort(reverse=True)
print(x + 1, arr[1])


num_of_bidders = input()
bids = input()
list1 = bids.split(' ')
winner = 0
list2 = [int(i) for i in list1]
max_bid = max(list2)
i = 0
while i < len(list2):
	if list2[i] == max_bid:
		winner = i + 1
		list2.pop(i)
		break
	i += 1
final_bid = max(list2)
print('{} {}'.format(winner, final_bid))


from operator import itemgetter

class CodeforcesTask386ASolution:

	def __init__(self):
		self.result = ''
		self.n = 0
		self.bids = []

	def read_input(self):
		self.n = int(input())
		self.bids = [int(x) for x in input().split(' ')]

	def process_task(self):
		biding = [(x + 1, self.bids[x]) for x in range(self.n)]
		biding.sort(key=itemgetter(1), reverse=True)
		self.result = '{0} {1}'.format(biding[0][0], biding[1][1])

	def get_result(self):
		return self.result
Solution = CodeforcesTask386ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = int(input())
l = list(map(int, input().split()))
x = l.index(max(l)) + 1
l.sort()
y = l[-2]
print(x, y)


n = int(input())
l = list(map(int, input().split()))
l1 = sorted(l, reverse=True)
print(l.index(max(l)) + 1, l1[1])


n = int(input())
a = list(map(int, input().split()))
p = a.index(max(a))
a.pop(p)
print(p + 1, max(a))


import sys
import math
n = int(sys.stdin.readline())
pn = [int(x) for x in sys.stdin.readline().split()]
vmax = 0
rmax = 0
ind = 0
for i in range(n):
	if pn[i] > vmax:
		rmax = vmax
		vmax = pn[i]
		ind = i + 1
	elif pn[i] > rmax:
		rmax = pn[i]
print(ind, rmax)


count = int(input())
prices = [int(p) for p in input().split()]
winner = prices.index(max(prices))
prices.insert(winner, -1)
prices.remove(max(prices))
print(winner + 1, max(prices))


try:
	n = int(input())
	p = list(map(int, input().split(' ')))
	l = max(p)
	k = p.index(l) + 1
	p.remove(l)
	u = max(p)
	print(str(k) + ' ' + str(u))
except:
	pass


n = int(input())
lst = list(map(int, input().split()))
q = lst.index(max(lst)) + 1
lst.sort()
p = lst[-2]
print(q, p)


n = int(input())
a = list(map(int, input().split()))
b = sorted(a)
x = a.index(max(a)) + 1
print(x, b[-2])


n = int(input())
p = list(map(int, input().split()))
h = 0
i = 0
for x in p:
	if x > h:
		h = x
i = p.index(h) + 1
p.remove(h)
h = 0
for x in p:
	if x > h:
		h = x
print(str(i) + ' ' + str(h))


n = int(input())
prs = [int(x) for x in input().split()]
print(prs.index(max(prs)) + 1, sorted(prs)[-2])


n = int(input())
array = list(map(int, input().strip().split()))
lar = max(array)
winner_index = array.index(lar) + 1
array.remove(lar)
money_pay = max(array)
print(str(winner_index) + ' ' + str(money_pay))


bidders = int(input())
bids = [int(x) for x in input().split(' ')]
high = 0
second = 0
pos = 0
for i in range(0, len(bids)):
	if int(bids[i]) > high:
		position = i + 1
		second = high
		high = bids[i]
	if bids[i] > second and bids[i] < high:
		second = bids[i]
print(position, second)


n = int(input())
p = input().split()
index = 0
bid2 = 0
bid = 0
for i in range(len(p)):
	if int(p[i]) > bid:
		bid = int(p[i])
		index = i + 1
for i in range(len(p)):
	if int(p[i]) > bid2 and int(p[i]) != bid:
		bid2 = int(p[i])
print(index, bid2)


n = int(input())
c1 = input().split(' ')
c = []
for i in c1:
	c.append(int(i))
mx = max(c)
i = c.index(mx)
c.remove(mx)
mx1 = max(c)
print(i + 1, int(mx1))


n = int(input())
prices = [int(s) for s in input().split(' ')]
new_prices = [[i + 1, prices[i]] for i in range(n)]
new_prices = sorted(new_prices, key=lambda x: x[1])
print(new_prices[n - 1][0], new_prices[n - 2][1])


n = int(input())
x = list(map(int, input().split()))
xx = max(x)
for i in range(n):
	if x[i] == xx:
		maxx = i + 1
a = x
a.remove(xx)
max_a = max(a)
print(maxx, max_a, sep=' ')


n = int(input())
a = list(map(int, input().split()))
z = []
for i in range(n):
	z.append([a[i], i + 1])
z.sort()
print(z[-1][1], z[-2][0])


import builtins
import sys
import math
import re
import itertools
import collections
import random
n = int(input())
bidders = tuple((i for i in map(int, input().split())))
s = set(bidders)
highest = max(s)
winner = bidders.index(highest) + 1
s.remove(highest)
pay = max(s)
print(winner, pay)


n = int(input())
p = [0, 0]
idx = [-1, -1]
bidders = [int(i) for i in input().split(' ')]
for (i, v) in enumerate(bidders):
	if v > p[0]:
		p[1] = p[0]
		idx[1] = idx[0]
		p[0] = v
		idx[0] = i
	elif v > p[1]:
		p[1] = v
		idx[1] = i
print(idx[0] + 1, p[1])


n = int(input())
bids = [int(i) for i in input().split()]
index = max(((x, i) for (i, x) in enumerate(bids)))[1]
bids.pop(index)
index = index + 1
print(str(index) + ' ' + str(max(bids)))


input()
l = list(map(int, input().split()))
k = sorted(l)
print(1 + l.index(k[-1]), k[-2])


a = int(input())
a = list(map(int, input().split()))
ind = a.index(max(a))
a.sort()
print(str(ind + 1) + ' ' + str(a[-2]))


nums = int(input())
a = list(map(int, input().split()))
m = a[0]
mi = 0
n = 0
for i in range(1, nums):
	if a[i] >= m:
		n = m
		m = a[i]
		mi = i
	elif a[i] >= n:
		n = a[i]
print(mi + 1, n)


import sys

def main():
	(_, *l) = map(int, sys.stdin.read().strip().split())
	t = sorted(zip(l, range(1, len(l) + 1)))[-2:]
	return (t[1][1], t[0][0])
print(*main())


n = int(input())
P = list(map(int, input().split()))
for (i, v) in enumerate(P):
	P[i] = [v, i]
P.sort()
print(P[-1][1] + 1, end=' ')
print(P[-2][0])


input()
l = list(map(int, input().split()))
a = l.index(max(l))
l.remove(max(l))
l.sort()
print(a + 1, l[-1], sep=' ')


input()
l = list(map(int, input().split()))
print(l.index(max(l)) + 1, sorted(l)[len(l) - 2])


num = int(input())
arr = list(map(int, input().split()))
sor = sorted(arr)
print(arr.index(max(arr)) + 1, sor[-2])


t = int(input())
lst = list(map(int, input().strip().split()))
win = max(lst)
for i in range(len(lst)):
	if lst[i] == win:
		a = i + 1
		lst.remove(max(lst))
		break
price = max(lst)
price = str(price)
a = str(a)
print(a + ' ' + price)


n = int(input())
l = list(map(int, input().split()))
m = max(l)
ind = 0
for i in range(n):
	if l[i] == m:
		ind = i + 1
		l[i] = 0
m2 = max(l)
print(ind, m2)


n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
	b.append([a[i], i])
b.sort(reverse=True)
print(b[0][1] + 1, b[1][0])


n = int(input())
prices = [int(x) for x in input().split()]
idx = 0
max_price = prices[0]
pay = 0
for i in range(1, n):
	if prices[i] > max_price:
		pay = max_price
		max_price = prices[i]
		idx = i
	elif prices[i] > pay:
		pay = prices[i]
print(str(idx + 1) + ' ' + str(pay))


t = int(input())
l = list(map(int, input().split()))
st = 0
p = 0
for i in range(len(l)):
	if l[i] > st:
		st = l[i]
		p = i + 1
print(p, sorted(l)[-2])


input()
bet = [int(i) for i in input().split()]
x = bet.index(max(bet)) + 1
bet.sort()
print(x, bet[-2])


N = int(input())
bids = [int(i) for i in input().split(' ')]
max_bid = bids[0]
max_bid_index = 0
for i in range(len(bids)):
	if bids[i] > max_bid:
		max_bid = bids[i]
		max_bid_index = i
rup_bid = bids[0 if max_bid_index != 0 else 1]
for i in range(len(bids)):
	if bids[i] == max_bid:
		continue
	elif bids[i] > rup_bid:
		rup_bid = bids[i]
max_bid_index += 1
print(max_bid_index, rup_bid)


n = int(input())
v = list(map(int, input().split()))
ret = max(v)
idx = v.index(ret)
v[idx] = -1
ret = max(v)
print(str(idx + 1) + ' ' + str(ret))


amount_players = int(input())
price_list = list(map(int, input().split()))
first_max_price = 0
second_max_price = 0
for i in range(amount_players):
	if price_list[i] >= first_max_price:
		index_player = i + 1
		second_max_price = first_max_price
		first_max_price = price_list[i]
	elif price_list[i] > second_max_price:
		second_max_price = price_list[i]
print(index_player, second_max_price)


n = int(input())
nums = list(map(int, input().split()))
mydict = dict()
for (i, val) in enumerate(nums):
	mydict[val] = i + 1
nums.sort()
print(mydict[nums[-1]], nums[-2])


n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
	b += [[i + 1, a[i]]]
b.sort(key=lambda x: x[1])
print(b[-1][0], b[-2][1])


bidders = int(input())
bids1 = input()
bids = bids1.split(' ')
bids = [int(x) for x in bids]
highest = max(bids)
hIndex = bids.index(highest)
bids.remove(highest)
hIndex = hIndex + 1
sechighest = max(bids)
print(hIndex, sechighest)


n = int(input())
price = input().split(' ')
for i in range(n):
	price[i] = int(price[i])
j = price.index(max(price))
sorted_price = sorted(price)
print(j + 1, sorted_price[n - 2])


n = int(input())
a = list(map(int, input().split()))
b = sorted(a)
k = b[-1]
i = a.index(k)
i = i + 1
print(i, b[-2])


n = int(input())
li = list(map(int, input().split()))
a = li.index(max(li)) + 1
li.remove(max(li))
print(str(a) + ' ' + str(max(li)))


n = int(input())
l = list(map(int, input().split()))
m = max(l)
for i in range(n):
	if l[i] == m:
		print(i + 1, end=' ')
l.sort()
print(l[-2])


x = int(input())
y = list(map(int, input().split()))
d = max(y)
print(y.index(d) + 1, end=' ')
y.sort(reverse=True)
print(y[1])


n = int(input())
dfx = list(map(int, input().split()))
print(dfx.index(sorted(dfx)[n - 1]) + 1, sorted(dfx)[n - 2])


n = int(input())
x = [int(x) for x in input().split()]
i = x.index(max(x))
x.remove(max(x))
print(i + 1, max(x))


input()
P = list(map(int, input().split()))
i = P.index(max(P))
P.pop(i)
print(i + 1, max(P))


import sys
ii = lambda : sys.stdin.readline().strip()
idata = lambda : [int(x) for x in ii().split()]

def solve():
	n = int(ii())
	data = idata()
	pl = sorted(data)[-2]
	s = max(data)
	for i in range(n):
		if s == data[i]:
			print(i + 1, pl)
	return
for t in range(1):
	solve()


n = int(input())
prices = list(map(int, input().split()))
sorted_prices = sorted(prices)
print(prices.index(sorted_prices[n - 1]) + 1, end=' ')
print(sorted_prices[n - 2], end=' ')


n = int(input())
l = list(map(int, input().split()))
t = l.index(max(l))
l.sort()
print(t + 1, l[-2])


n = int(input())
p = list(map(int, input().split()))
m = max(p)
i = p.index(m) + 1
p.remove(m)
m = max(p)
print(str(i) + ' ' + str(m))


from math import *
import time
n = int(input())
l = input().split(' ')
indx = 0
min1 = 0
min2 = 0
for i in range(0, len(l)):
	val = int(l[i])
	if val > min1:
		min2 = min1
		min1 = val
		indx = i + 1
	elif val == min1:
		min2 = min1
	elif min2 < val:
		min2 = val
print(indx, min2)


n = int(input())
p = list(map(int, input().split()))
a = []
for i in range(n):
	a.append((i, p[i]))
a.sort(key=lambda k: k[1])
print(a[-1][0] + 1, a[-2][1])


n = int(input())
li = [*map(int, input().split())]
a = li.index(max(li))
li.pop(a)
b = max(li)
print(a + 1, b)


from math import *
from cmath import *
from itertools import *
from decimal import *
from fractions import *
from sys import *
from types import CodeType, new_class
n = int(input())
a = [int(x) for x in input().split()]
print(a.index(max(a)) + 1, end=' ')
a.sort()
print(a[-2])


__author__ = 'asmn'
n = int(input())
a = sorted(enumerate(map(int, input().split())), key=lambda x: -x[1])
print(a[0][0] + 1, a[1][1])


n = int(input())
p = list(map(int, input().strip().split()[:n]))
k = p.index(max(p)) + 1
p.remove(max(p))
print(k, max(p))


n = int(input())
l = list(map(int, input().split()))
li = l.copy()
li.sort(reverse=True)
print(l.index(li[0]) + 1, li[1])


n = int(input())
l = list(map(int, input().split()))
maxi = max(l)
print(l.index(maxi) + 1, end=' ')
l.sort()
l.pop()
print(max(l))


n = int(input())
bid = list(map(int, input().split()))
greatest = bid[0]
greatest_index = 1
for i in range(len(bid)):
	if bid[i] > greatest:
		second = greatest
		greatest = bid[i]
		greatest_index = i + 1
sort = sorted(bid)
second = sort[-2]
print(greatest_index, second)


n = int(input())
a = list(map(int, input().split()))
print(a.index(max(a)) + 1, max(a[:a.index(max(a))] + a[a.index(max(a)) + 1:]))


n = int(input())
l = list(map(int, input().split()))
m = l[0]
index = 1
for i in range(1, n):
	if l[i] > m:
		index = i + 1
		m = l[i]
sm = -1000
for i in range(n):
	if i != index - 1 and l[i] > sm:
		sm = l[i]
print(index, sm)


def second_maximum(lst):
	b = list()
	for i in range(len(lst)):
		b.append(tuple([lst[i], i + 1]))
	d = sorted(b, key=lambda x: x[0])
	return (d[len(d) - 1][1], d[len(d) - 2][0])
n = int(input())
a = [int(i) for i in input().split()]
print(*second_maximum(a))


def my_func(a):
	maximum_element = a[0]
	max_el_index = 0
	for i in range(len(a)):
		if maximum_element < a[i]:
			maximum_element = a[i]
			max_el_index = i
	a[max_el_index] = 0
	return (maximum_element, max_el_index)
n = map(int, input().split())
bids = list(map(int, input().split()))
(max_bid, max_bid_pos) = my_func(bids)
(second_max_bid, _) = my_func(bids)
print(max_bid_pos + 1, second_max_bid)


T_ON = 0
DEBUG_ON = 1
MOD = 998244353

def solve():
	n = read_int()
	A = read_ints()
	a = max(A)
	pos = A.index(a)
	A.remove(a)
	b = max(A)
	print(pos + 1, b)

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def read_int():
	return int(input())

def read_ints():
	return list(map(int, input().split()))

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def First():
	print('First')

def Second():
	print('Second')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def lcm(a, b):
	d = gcd(a, b)
	return a * b // d

def is_even(x):
	return x % 2 == 0

def is_odd(x):
	return x % 2 == 1

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i:
			return False
	return True

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P
main()


n = int(input())
l = list(map(int, input().split()))
a = l[0]
b = 1
for i in range(n):
	if l[i] > a:
		a = l[i]
		b = i + 1
l.sort()
print(b, end=' ')
print(l[n - 2])


import math
n = int(input())
a = list(map(int, input().split()))
print(a.index(max(a)) + 1, sorted(a)[-2])


n = int(input())
arr = list(map(int, input().split()))
print(arr.index(max(arr)) + 1, end=' ')
arr.sort()
print(arr[n - 2])


n = int(input())
sp = list(map(int, input().split()))
maxi = sp.index(max(sp))
sort_sp = sorted(sp)
print(maxi + 1, sort_sp[-2])


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = map(int, input().split())
p = [*map(int, input().split())]
x = [*enumerate(p, start=0)]
x.sort(key=lambda x: x[1])
print(x[-1][0] + 1, x[-2][1])


def answer():
	n = int(input())
	l1 = [int(x) for x in input().split()]
	winner = l1.index(max(l1)) + 1
	l1.remove(max(l1))
	price = max(l1)
	print(winner, price)
answer()


n = int(input())
p = [int(s) for s in input().split(' ')]
ind = p.index(max(p)) + 1
price = sorted(p)[-2]
print(ind, price)


n = int(input())
l = list(map(int, input().split()))
m = max(l)
print(l.index(m) + 1, end=' ')
l.remove(m)
print(max(l))


n = int(input())
n1 = list(map(int, input().split()))
s = max(n1)
lst = []
v = ''
for i in range(n):
	if n1[i] != s:
		lst.append(n1[i])
	else:
		v = v + str(i + 1) + ' '
v = v + str(max(lst))
print(v)


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	l = LI()
	a = []
	for (i, x) in enumerate(l):
		a.append((i, x))
	a = sorted(a, key=lambda x: x[1])
	return str(a[-1][0] + 1) + ' ' + str(a[-2][1])
print(main())


import sys
n = int(input())
a = list(map(int, input().split()))
ans = a.index(max(a)) + 1
a.remove(max(a))
print(ans, max(a))


n = int(input())
mx = 0
mx2 = -1
prices = [int(el) for el in input().split()]
for i in range(n):
	if mx < prices[i]:
		k = i
		mx2 = mx
		mx = prices[i]
		prices[i] = 0
	if (mx2 < prices[i]) & (mx > mx2):
		mx2 = prices[i]
print(k + 1, mx2)


n = int(input())
p = list(map(int, input().split()))
a = sorted(p, reverse=True)[1]
print(*[p.index(max(p)) + 1, a])


n = int(input())
lst = [int(i) for i in input().split()]
max1 = max(lst)
d = lst.index(max1) + 1
lst.remove(max1)
print(d, max(lst))


n = int(input())
arr = list(map(int, input().split()))
index = arr.index(max(arr))
arr.remove(max(arr))
print(index + 1, max(arr))


n = int(input())
x = [int(x) for x in input().split()]
a = x.index(max(x))
x.sort()
print(a + 1, x[-2])


n = int(input())
p = list(map(int, input().split()[:n]))
w = p.index(max(p))
p.remove(max(p))
print(w + 1, max(p))


n = int(input())
l = [int(x) for x in input().split()]
i = 1
off = []
for x in l:
	off.append((x, i))
	i += 1
off.sort(reverse=True)
print(str(off[0][1]) + ' ' + str(off[1][0]))


n = int(input())
a = list(map(int, input().split()))
x = a.index(max(a)) + 1
a.remove(max(a))
print(x, max(a))


n = int(input())
l = list(map(int, input().split()))
p = l.copy()
l.sort()
print(p.index(l[-1]) + 1, l[-2])


a = int(input())
max_n = 0
max_1 = 0
max_2 = 0
k = 0
b = [int(i) for i in input().split()]
for i in range(len(b)):
	if max(b[i], max_n) > max_n:
		max_1 = max_n
		k = i + 1
		max_n = max(b[i], max_n)
dp = [i for i in range(len(b))]
dp.reverse()
max_n = 0
for i in dp:
	if max(b[i], max_n) > max_n:
		max_2 = max_n
		k = i + 1
		max_n = max(b[i], max_n)
print(str(k) + ' ' + str(max(max_1, max_2)))


garbage = int(input())
z = list(map(int, input().rstrip().split(' ')))
ind = z.index(max(z))
z.sort()
res = z[-2]
print(ind + 1, res)


n = int(input())
arr = list(map(int, input().split()))
arr1 = sorted(arr)
print(arr.index(arr1[n - 1]) + 1, arr1[n - 2])


n = int(input())
a = list(map(int, input().split()))
x = sorted(enumerate(a), key=lambda y: y[1])
print(x[n - 1][0] + 1, x[n - 2][1])


n = int(input())
bid = list(map(int, input().split(' ')))
i = bid.index(max(bid))
bid[i] = -1
m = max(bid)
print(i + 1, m)


num_bids = int(input())
bids = [int(bids) for bids in input().split()]
maxi1 = max(bids)
a = bids.index(maxi1)
print(a + 1, end=' ')
del bids[a]
print(max(bids))


n = int(input())
p = list(map(int, input().split()))
b = sorted(p)
a = max(p)
c = p.index(a) + 1
d = b[-2]
print(c, d)


n = int(input())
prices = list(map(int, input().split()))
index = None
win = 0
for i in range(n):
	win = max(win, prices[i])
print(prices.index(win) + 1, end=' ')
prices.remove(win)
win = 0
for i in range(n - 1):
	win = max(win, prices[i])
print(win)


n = int(input())
l = list(map(int, input().split()))
z = l.index(max(l))
del l[z]
print(z + 1, max(l))


n = int(input())
bidders = list(map(int, input().split()))
num = bidders.index(max(bidders)) + 1
bidders.remove(max(bidders))
price = max(bidders)
print(num, price)


n = int(input())
x = list(map(int, input().split()))
max_1 = max(x)
index = x.index(max_1)
x.remove(max_1)
max_2 = max(x)
print(index + 1, max_2)


x = int(input())
l = list(map(int, input().split()))
m = max(l)
i = l.index(m)
l.remove(m)
m1 = max(l)
print(i + 1, m1)


n = int(input())
a = list(map(int, input().split()))
a = sorted([[a[i], i + 1] for i in range(n)])
print(a[-1][1], a[-2][0])


n = int(input())
l = list(map(int, input().split()))
ind = l.index(max(l))
l.pop(ind)
print(ind + 1, max(l))


n = int(input())
c = input()
c = c.split()
m = []
for i in range(n):
	m.append(int(c[i]))
a = max(m)
s = str(m.index(a) + 1) + ' '
if n == 1:
	print(s + '1')
else:
	m.remove(a)
	b = max(m)
	print(s + str(b))


n = int(input())
bidders = list(map(int, input().split()))
answer = str(bidders.index(max(bidders)) + 1)
bidders.pop(bidders.index(max(bidders)))
answer += ' ' + str(max(bidders))
print(answer)


from sys import stdin, stdout
(winner, price) = (0, 0)
people = int(stdin.readline().rstrip())
bets = [int(x) for x in stdin.readline().rstrip().split()]
winner = bets.index(max(bets)) + 1
bets.pop(winner - 1)
price = max(bets)
returned = str(winner) + ' ' + str(price)
stdout.write(returned)


N = int(input())
A = list(map(int, input().split()))
Val = A.index(max(A)) + 1
A.sort(reverse=True)
print(Val, A[1])


n = int(input())
l = list(map(int, input().split()))
max_val = l[0]
index = 1
for i in range(1, n):
	if max_val < l[i]:
		max_val = l[i]
		index = i + 1
l.sort(reverse=True)
print(f'{index} {l[1]}')


n = int(input())
a = list(map(int, input().split()))
if a[0] > a[1]:
	i = 0
	j = 1
else:
	j = 0
	i = 1
for k in range(2, n):
	if a[k] > a[i]:
		j = i
		i = k
	elif a[k] > a[j]:
		j = k
print(i + 1, a[j])


n = int(input())
bid = list(map(int, input().split(' ')))
highest = 0
second = 0
position = 0
for i in range(0, n):
	if int(bid[i]) > highest:
		position = i + 1
		second = highest
		highest = bid[i]
	if bid[i] > second and bid[i] < highest:
		second = bid[i]
print(position, second)


n = int(input())
arr = list(map(int, input().split()))
l1 = []
ind = arr.index(max(arr))
l1.append(ind + 1)
arr.sort()
l1.append(arr[-2])
for i in range(len(l1)):
	print(l1[i], end=' ')


n = int(input())
prices = list(map(int, input().split()))
length = len(prices)
for x in range(length):
	if max(prices) == prices[x]:
		print(x + 1, end=' ')
		prices[x] = -1
		print(max(prices))
		break


n = int(input())
bidders = [int(i) for i in input().split()]
bokita = max(bidders)
a = bidders.index(bokita) + 1
bidders.remove(bokita)
garpa_bokita = max(bidders)
print(a, garpa_bokita)


n = int(input())
p = [int(i) for i in input().split()]
m = max(p[0], p[1])
m_price = min(p[0], p[1])
m_pos = 1
for i in range(n):
	if m <= p[i]:
		m = p[i]
		m_pos = i + 1
for i in range(n):
	if m_price <= p[i] < m:
		m_price = p[i]
print(m_pos, m_price)


n = int(input())
l = list(map(int, input().split()))
s = sorted(l, reverse=True)
print(l.index(s[0]) + 1, s[1])


n = int(input())
prices = list(map(int, input().split()))
winner = prices.index(max(prices)) + 1
prices.pop(prices.index(max(prices)))
money = max(prices)
print(winner, money)


n = int(input())
x = list(map(int, input().split()))
c = x.copy()
c.sort()
print(x.index(max(x)) + 1, c[-2])


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x) + '\n')
n = get_int()
lst = get_int_list()
print(lst.index(max(lst)) + 1, sorted(lst)[-2])


a = int(input())
t = list(map(int, input().split()))
u = max(t)
h = t.index(u) + 1
for x in range(t.count(u)):
	t[t.index(u)] = 0
print(h, max(t))


n = int(input())
a = list(map(int, input().split()))
b = sorted(a)
(p1, p2) = (b[-1], b[-2])
print(a.index(p1) + 1, p2)


n = int(input())
a = list(map(int, input().split()))
print(a.index(max(a)) + 1, end=' ')
del a[a.index(max(a))]
print(max(a))


n = int(input())
l = list(map(int, input().split()))
max1 = max(l)
max2 = 0
for i in l:
	if i > max2 and i != max1:
		max2 = i
print(l.index(max1) + 1, max2)


n = int(input())
l = [int(x) for x in input().split()]
g = sorted(l)
a = l.index(g[-1]) + 1
print(a, g[-2])


n = int(input())
ar = input().split()
for i in range(n):
	ar[i] = int(ar[i])
for i in range(n):
	if ar[i] == max(ar):
		print(i + 1, end=' ')
		break
ar.sort()
print(ar[-2])


from sys import stdin, stdout

def main():
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split(' ')))
	m = max(a)
	stdout.write(str(a.index(m) + 1) + ' ')
	a.remove(m)
	stdout.write(str(max(a)) + '\n')
main()


def findmax(array):
	maximum = -1
	for j in range(0, len(array)):
		maximum = max(array[j], maximum)
	return maximum
n = int(input())
arr = [int(x) for x in input().split()]
max_fst = findmax(arr)
indx_max = -1
for i in range(0, n):
	if max_fst == arr[i]:
		arr[i] = 0
		indx_max = i + 1
		break
max_scnd = findmax(arr)
print(indx_max, max_scnd)


n = int(input())
l = list(map(int, input().split()))
x = l[0]
(i, f) = (1, 0)
for j in range(1, n):
	if f == 0:
		if x > l[j]:
			y = l[j]
			f = 1
	if x < l[j]:
		y = x
		x = l[j]
		i = j + 1
		f = 1
	elif f == 1:
		if y < l[j]:
			y = l[j]
print(i, y)


n = int(input())
price = list(map(int, input().split()))
highest = max(price)
ans = []
ans.append(price.index(highest) + 1)
price.sort()
second_highest = price[-2]
ans.append(second_highest)
print(*ans)