n = int(eval(input()))

A = sorted([int(i) for i in input().split()])

A_max = A.pop()

print((A_max, min(A, key=lambda x:abs(A_max-x*2))))
n = int(eval(input()))

A = [int(i) for i in input().split()]

A_max = max(A)

A.remove(A_max)

print((A_max, min(A, key=lambda x:abs(A_max-x*2))))
n = int(eval(input()))
A = sorted([int(i) for i in input().split()])
A_max = A.pop()
print((A_max, min(A, key=lambda x: abs(A_max - x * 2))))

n = int(eval(input()))
A = [int(i) for i in input().split()]
A_max = max(A)
A.remove(A_max)
print((A_max, min(A, key=lambda x: abs(A_max - x * 2))))

-A = sorted([int(i) for i in input().split()]) -A_max = A.pop() +A = [int(i) for i in input().split()] +A_max = max(A) +A.remove(A_max)