local n=io.read("n")
local a={}
for i=1,n do
    a[i]=io.read("n")
end
table.sort(a)

local k=10^9+1
local l=0
for i=1,n do
    local diff=math.abs(a[n]/2-a[i])
    if k>diff then
        k=diff
        l=a[i]
    end
end
print(a[n],l)