import numpy as np



n = int(eval(input()))

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

As = sorted(A)

m = As[-1]

s = np.searchsorted(As,m/2)

d1 = abs(m/2-As[s])

d2 = abs(m/2-As[s-1])

if d1 >= d2:

    r = As[s-1]

else:

    r = As[s]

print((m,r))
n = int(eval(input()))

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

m = max(A) 

min = float("inf")

for i in range(n):

  if min > abs(A[i] - m/2) and A[i] != m: 

    min = abs(A[i] - m/2)

    r = A[i]

print((m,r))

import numpy as np

n = int(eval(input()))
A = list(map(int, input().split()))
As = sorted(A)
m = As[-1]
s = np.searchsorted(As, m / 2)
d1 = abs(m / 2 - As[s])
d2 = abs(m / 2 - As[s - 1])
if d1 >= d2:
    r = As[s - 1]
else:
    r = As[s]
print((m, r))

n = int(eval(input()))
A = list(map(int, input().split()))
m = max(A)
min = float("inf")
for i in range(n):
    if min > abs(A[i] - m / 2) and A[i] != m:
        min = abs(A[i] - m / 2)
        r = A[i]
print((m, r))

-import numpy as np - -As = sorted(A) -m = As[-1] -s = np.searchsorted(As, m / 2) -d1 = abs(m / 2 - As[s]) -d2 = abs(m / 2 - As[s - 1]) -if d1 >= d2: -    r = As[s - 1] -else: -    r = As[s] +m = max(A) +min = float("inf") +for i in range(n): +    if min > abs(A[i] - m / 2) and A[i] != m: +        min = abs(A[i] - m / 2) +        r = A[i]