import sys

def input(): return sys.stdin.readline().strip()

import math

def resolve():

    n=int(eval(input()))

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

    l.sort(reverse=True)

    ans=0

    jissitu=0

    naka=l[0]//2

    for i in range(1,n):

        if l[i]>naka and l[0]-i>jissitu:

            ans=l[i]

            jissitu=l[0]-l[i]

        elif l[i]<=naka and l[i]>jissitu:

            ans=l[i]

            jissitu=l[i]

    print((l[0],ans))

resolve()
import sys

def input(): return sys.stdin.readline().strip()

import math

def resolve():

    n=int(eval(input()))

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

    l.sort(reverse=True)

    a=l[0]

    l.pop(0)

    bnum=0

    bmax=0

    for i in l:

        bb=min(i,a-i)

        if bmax<bb:

            bnum=i

            bmax=bb

    print((a,bnum))

resolve()
import sys


def input():
    return sys.stdin.readline().strip()


import math


def resolve():
    n = int(eval(input()))
    l = list(map(int, input().split()))
    l.sort(reverse=True)
    ans = 0
    jissitu = 0
    naka = l[0] // 2
    for i in range(1, n):
        if l[i] > naka and l[0] - i > jissitu:
            ans = l[i]
            jissitu = l[0] - l[i]
        elif l[i] <= naka and l[i] > jissitu:
            ans = l[i]
            jissitu = l[i]
    print((l[0], ans))


resolve()

import sys


def input():
    return sys.stdin.readline().strip()


import math


def resolve():
    n = int(eval(input()))
    l = list(map(int, input().split()))
    l.sort(reverse=True)
    a = l[0]
    l.pop(0)
    bnum = 0
    bmax = 0
    for i in l:
        bb = min(i, a - i)
        if bmax < bb:
            bnum = i
            bmax = bb
    print((a, bnum))


resolve()

-    ans = 0 -    jissitu = 0 -    naka = l[0] // 2 -    for i in range(1, n): -        if l[i] > naka and l[0] - i > jissitu: -            ans = l[i] -            jissitu = l[0] - l[i] -        elif l[i] <= naka and l[i] > jissitu: -            ans = l[i] -            jissitu = l[i] -    print((l[0], ans)) +    a = l[0] +    l.pop(0) +    bnum = 0 +    bmax = 0 +    for i in l: +        bb = min(i, a - i) +        if bmax < bb: +            bnum = i +            bmax = bb +    print((a, bnum))