local N=io.read("n")
local a={}
for i=1,N do
  a[i]=io.read("n")
end
function c(n,m)
  local res=0
  local s=1
  local k=1
  for i=n,n-m+1,-1 do
    s=s*i
  end
  for i=1,m do
    k=k*i
  end
  return s//k
end
table.sort(a,function (a,b) return a>b end)
local first=a[1]
local second=a[2]
local total=c(a[1],a[2])
for i=1,N-1 do
  for j=i+1,N do
    if c(a[i],a[j])>total then
      total=c(a[i],a[j])
      first=a[i]
      second=a[j]
    end
  end
end
print(first,second)