import Data.List (sortBy)

main :: IO ()
main = do
  _ <- read <$> getLine :: IO Int
  (ai:as) <- sortBy (flip compare).map read.words <$> getLine :: IO [Int]
  let md = fromIntegral ai/2 :: Double
      aj = foldr1 (\a b-> if abs(fromIntegral a-md) < abs(fromIntegral b-md) then a else b) as
  putStrLn $ unwords $ map show [ai, aj]
