local mfl = math.floor
local function lower_bound(ary, x)
  if(x <= ary[1]) then return 1 end
  local num = #ary
  if(ary[num] < x) then return num + 1 end
  local min, max = 1, num
  while(1 < max - min) do
    local mid = mfl((min + max) / 2)
    if(ary[mid] < x) then
      min = mid
    else
      max = mid
    end
  end
  return max
end

local n = io.read("*n")
local a = {}
for i = 1, n do a[i] = io.read("*n") end
table.sort(a)
local max = a[n]
table.remove(a)
local idx = lower_bound(a, max / 2)
if(idx == n) then
  idx = n - 1
elseif(1 < idx) then
  if(math.abs(max - 2 * a[idx - 1]) < math.abs(max - 2 * a[idx])) then
    idx = idx - 1
  end
end
print(max .. " " .. a[idx])
