n,*a=list(map(int,open(0).read().split()))

m=max(a)

b=m//2

o=min(a)

for A in a:

 if abs(A-b)<abs(o-b):o=A

print((m,o))

n,a=open(0)

*a,=list(map(int,a.split()))

m=max(a)

print((m,min((abs(m-2*i),i)for i in a)[1]))

n, *a = list(map(int, open(0).read().split()))
m = max(a)
b = m // 2
o = min(a)
for A in a:
    if abs(A - b) < abs(o - b):
        o = A
print((m, o))

n, a = open(0)
(*a,) = list(map(int, a.split()))
m = max(a)
print((m, min((abs(m - 2 * i), i) for i in a)[1]))

-n, *a = list(map(int, open(0).read().split())) +n, a = open(0) +(*a,) = list(map(int, a.split())) -b = m // 2 -o = min(a) -for A in a: -    if abs(A - b) < abs(o - b): -        o = A -print((m, o)) +print((m, min((abs(m - 2 * i), i) for i in a)[1]))