#from statistics import median

#import collections

#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]

#from fractions import gcd

#from itertools import combinations # (string,3) 3回

#from collections import deque

from collections import defaultdict

#import bisect

#

#    d = m - k[i] - k[j]

#    if kk[bisect.bisect_right(kk,d) - 1] == d:

#

#

#

# pythonで無理なときは、pypyでやると正解するかも！！

#

#



import sys

sys.setrecursionlimit(10000000)

mod = 10**9 + 7

#mod = 9982443453

def readInts():

  return list(map(int,input().split()))

def I():

  return int(eval(input()))

n = I()

A = readInts()

A = sorted(A)

MAX = A[-1]

MIN = A[0]

for i in range(1,n-1):

    if abs(MAX/2 - A[i]) <= abs(MAX/2 - MIN):

        MIN = A[i]

print((MAX,MIN))

#from statistics import median

#import collections

#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]

from fractions import gcd

from itertools import combinations,permutations,accumulate # (string,3) 3回

#from collections import deque

from collections import deque,defaultdict,Counter

#import bisect

#

#    d = m - k[i] - k[j]

#    if kk[bisect.bisect_right(kk,d) - 1] == d:

#

#

#

# pythonで無理なときは、pypyでやると正解するかも！！

#

#



import sys

sys.setrecursionlimit(10000000)

mod = 10**9 + 7

#mod = 9982443453

def readInts():

  return list(map(int,input().split()))

def I():

  return int(eval(input()))

n = I()

A = readInts()

m = max(A)

nya = m

mid = m/2

for i in range(n):

    if abs(A[i] - mid) <= nya:

        nya = abs(A[i]-mid)

        k = A[i]

print((m,k))

# from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
# from fractions import gcd
# from itertools import combinations # (string,3) 3回
# from collections import deque
from collections import defaultdict

# import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
import sys

sys.setrecursionlimit(10000000)
mod = 10**9 + 7
# mod = 9982443453
def readInts():
    return list(map(int, input().split()))


def I():
    return int(eval(input()))


n = I()
A = readInts()
A = sorted(A)
MAX = A[-1]
MIN = A[0]
for i in range(1, n - 1):
    if abs(MAX / 2 - A[i]) <= abs(MAX / 2 - MIN):
        MIN = A[i]
print((MAX, MIN))

# from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate  # (string,3) 3回

# from collections import deque
from collections import deque, defaultdict, Counter

# import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
import sys

sys.setrecursionlimit(10000000)
mod = 10**9 + 7
# mod = 9982443453
def readInts():
    return list(map(int, input().split()))


def I():
    return int(eval(input()))


n = I()
A = readInts()
m = max(A)
nya = m
mid = m / 2
for i in range(n):
    if abs(A[i] - mid) <= nya:
        nya = abs(A[i] - mid)
        k = A[i]
print((m, k))

-# from fractions import gcd -# from itertools import combinations # (string,3) 3回 +from fractions import gcd +from itertools import combinations, permutations, accumulate  # (string,3) 3回 + -from collections import defaultdict +from collections import deque, defaultdict, Counter -A = sorted(A) -MAX = A[-1] -MIN = A[0] -for i in range(1, n - 1): -    if abs(MAX / 2 - A[i]) <= abs(MAX / 2 - MIN): -        MIN = A[i] -print((MAX, MIN)) +m = max(A) +nya = m +mid = m / 2 +for i in range(n): +    if abs(A[i] - mid) <= nya: +        nya = abs(A[i] - mid) +        k = A[i] +print((m, k))