import Data.List

main = do
  n <- read <$> getLine :: IO Int
  as <- map read . words <$> getLine :: IO [Int]
  putStrLn $ unwords $ map show $ solve $ sortBy (flip compare) as

solve :: [Int] -> [Int]
solve (a:as) =
  [a,r]
  where
    r = minimumBy (\x y-> compare (abs $ x - div a 2) (abs $ y - div a 2)) as
