Let {\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order. From n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\rm comb}(a_i,a_j) is maximized. If there are multiple pairs that maximize the value, any of them is accepted.
from bisect import bisect_left, bisect_right
N = int(input())
*A, = map(int, input().split())
A.sort()
m = A[-1]
div = m / 2
print(m, min(abs(m - A[bisect_right(A, m / 2)]), abs(m - A[bisect_left(A, m / 2)])))
N = int(input())
*A, = map(int, input().split())
A.sort()
m = A[-1]
x = m / 2
ans = A[0]
for i in range(1, N-1):
    if abs(ans - x) > abs(A[i] - x):
        ans = A[i]
print(m, ans)