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.
N = int(input())
a = list(map(int, input().split()))
if N == 2:
    print(max(a), min(a))
    quit()
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
a.sort()
from bisect import bisect_left

cur = a[N - 1] // 2
s = bisect_left(a, cur)
ans = [a[N - 1], a[s]]
if cmb(a[N - 1], a[s]) < cmb(a[N - 1], a[s - 1]):
    ans[1] = a[s - 1]
print(ans)
N = int(input())
a = list(map(int, input().split()))
if N == 2:
    print(max(a), min(a))
    quit()
a.sort()
from bisect import bisect_left

cur = a[N - 1] // 2
s = bisect_left(a, cur)
min_ = float('Inf')
for i in range(-1, 2):
    #print(i)
    if min_ > abs(a[N - 1] - 2 * a[s + i]):
        min_ = abs(a[N - 1] - 2 * a[s + i])
        arg = i
print(a[N - 1], a[s + arg])