import Data.List

main = do
  _ <- getLine
  xs <- sort . map read . words <$> getLine
  let v (x, y) =
        if x < y then x * (y-x) else y * (x-y)
      f x y =
        compare (v x) (v y)
  putStrLn $ (\(x, y) -> show y ++ " " ++ show x) $ maximumBy f $ candidate xs

candidate [] = []
candidate (x:xs) =
  map ((,) x) xs ++ candidate xs