N=io.read("n")
local a={}
for i=1,N do
	a[i]=io.read("n")
end
function c(n,m)
	local res=0
	if m<=n//2 then
		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
		res=s//k
		else res=c(n,n-m)
	end
	return res
end
table.sort(a,function (a,b) return a>b end)
local a1=a[1]
local b1=a[2]
local total=c(a1,b1)
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])
			a1=a[i]
			b1=a[j]
		end
	end
end
print(a1,b1)
