Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted.
import sys
from scipy.misc import comb
import bisect
input = sys.stdin.readline
N = int(input())
A = sorted(list(map(int, input().split())))
l = bisect.bisect_left(A,A[-1]//2)-1
r = l+1
if comb(A[-1],A[l]) > comb(A[-1],A[r]):
    print(A[-1],A[l])
else:
    print(A[-1],A[r])
import sys

input = sys.stdin.readline
N = int(input())
A = sorted(list(map(int, input().split())))
tmp = A[-1]
ans = 0
for i in A[:-1]:
    if abs(A[-1] // 2 - i) < tmp:
        tmp = abs(A[-1] // 2 - i)
        ans = i
    elif A[-1] % 2 != 0 and abs(A[-1] // 2 - i + 1) < tmp:
        tmp = abs(A[-1] // 2 - i + 1)
        ans = i
print(A[-1], ans)
