N = int(eval(input()))

A = list(map(int,input().split()))

A.sort(reverse=True)

max_val = A[0]

min_val = float("inf")

for i in range(1,N):

    tmp_min = abs(max_val / 2 - A[i])

    if min_val > tmp_min:

        min_val = tmp_min

        ans_min = A[i]

print((max_val , ans_min))
import math

N = int(eval(input()))

A = list(map(int, input().split()))

A.sort()

ans = A[-1]

target = math.ceil(A[-1] / 2)

dis = float('inf')

for a in A:

    tmp_dis = abs(target - a)

    if tmp_dis < dis:

        dis = tmp_dis

        tmp_ans = a

print((ans, tmp_ans))

N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
max_val = A[0]
min_val = float("inf")
for i in range(1, N):
    tmp_min = abs(max_val / 2 - A[i])
    if min_val > tmp_min:
        min_val = tmp_min
        ans_min = A[i]
print((max_val, ans_min))

import math

N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = A[-1]
target = math.ceil(A[-1] / 2)
dis = float("inf")
for a in A:
    tmp_dis = abs(target - a)
    if tmp_dis < dis:
        dis = tmp_dis
        tmp_ans = a
print((ans, tmp_ans))

+import math + -A.sort(reverse=True) -max_val = A[0] -min_val = float("inf") -for i in range(1, N): -    tmp_min = abs(max_val / 2 - A[i]) -    if min_val > tmp_min: -        min_val = tmp_min -        ans_min = A[i] -print((max_val, ans_min)) +A.sort() +ans = A[-1] +target = math.ceil(A[-1] / 2) +dis = float("inf") +for a in A: +    tmp_dis = abs(target - a) +    if tmp_dis < dis: +        dis = tmp_dis +        tmp_ans = a +print((ans, tmp_ans))