import Data.List

main = do
  n <- getLine
  as <- getLine >>= return . sort . map read . words :: IO [Int]

  let m = last as
  let h = minimumBy (\a b -> compare (abs $ m-a*2) (abs $ m-b*2)) as
  putStrLn $ show m ++ " " ++ show h
