N = int(eval(input()))

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

A.sort()

M = A[-1]

a = M // 2

for i in range(N-1):

  if A[i] <= a and A[i+1] >= a:

    if (M-A[i])*A[i] >= (M-A[i+1])*A[i+1]:

      ans = [M, A[i]]

    else:

      ans = [M, A[i+1]]

ans = [str(b) for b in ans]

ans = ' '.join(ans)

print(ans)

      
n = int(input())

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

a.sort()

M = a[-1]

m = a[0]

C = -1

for i in range(n):

  c = a[i]*(M-a[i])

  if C < c:

    C = c

    m = a[i]

  else:

    break

print(M, m, sep=' ')

N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
M = A[-1]
a = M // 2
for i in range(N - 1):
    if A[i] <= a and A[i + 1] >= a:
        if (M - A[i]) * A[i] >= (M - A[i + 1]) * A[i + 1]:
            ans = [M, A[i]]
        else:
            ans = [M, A[i + 1]]
ans = [str(b) for b in ans]
ans = " ".join(ans)
print(ans)

n = int(input())
a = list(map(int, input().split()))
a.sort()
M = a[-1]
m = a[0]
C = -1
for i in range(n):
    c = a[i] * (M - a[i])
    if C < c:
        C = c
        m = a[i]
    else:
        break
print(M, m, sep=" ")

-N = int(eval(input())) -A = list(map(int, input().split())) -A.sort() -M = A[-1] -a = M // 2 -for i in range(N - 1): -    if A[i] <= a and A[i + 1] >= a: -        if (M - A[i]) * A[i] >= (M - A[i + 1]) * A[i + 1]: -            ans = [M, A[i]] -        else: -            ans = [M, A[i + 1]] -ans = [str(b) for b in ans] -ans = " ".join(ans) -print(ans) +n = int(input()) +a = list(map(int, input().split())) +a.sort() +M = a[-1] +m = a[0] +C = -1 +for i in range(n): +    c = a[i] * (M - a[i]) +    if C < c: +        C = c +        m = a[i] +    else: +        break +print(M, m, sep=" ")