import Data.List
import Data.Ord
solve a = (minimumBy (comparing (abs.(\x -> 2 * x - m))) $ init a, m)
  where m = last a
main = do
  getLine
  a <- getLine >>= return. map read. words :: IO [Integer]
  let (x, y) = solve.sort $ a
  putStrLn $ show y ++ " " ++ show x
