import numpy as np



n = int(eval(input()))

a = np.array(list(map(int, input().split())))

a.sort()



ai = a.max()



v, aj = 0, 0

for i in a[:-1]:

    tmp = i * (ai - i)

    if v < tmp:

        v = tmp

        aj = i

# print(v, aj)

print(ai)

print(aj)

import numpy as np



n = int(eval(input()))

a = np.array(list(map(int, input().split())))

ai = a.max()



v, aj = 0, 0

for i in a:

    tmp = i * (ai - i)

    if v < tmp:

        v = tmp

        aj = i

# print(v, aj)

print((*(ai, aj)))

import numpy as np

n = int(eval(input()))
a = np.array(list(map(int, input().split())))
a.sort()
ai = a.max()
v, aj = 0, 0
for i in a[:-1]:
    tmp = i * (ai - i)
    if v < tmp:
        v = tmp
        aj = i
# print(v, aj)
print(ai)
print(aj)

import numpy as np

n = int(eval(input()))
a = np.array(list(map(int, input().split())))
ai = a.max()
v, aj = 0, 0
for i in a:
    tmp = i * (ai - i)
    if v < tmp:
        v = tmp
        aj = i
# print(v, aj)
print((*(ai, aj)))

-a.sort() -for i in a[:-1]: +for i in a: -print(ai) -print(aj) +print((*(ai, aj)))