import Data.List

main = do
  n <- readLn
  as <- fmap (map read . words) getLine
  putStrLn $ unwords $ map show (solve n as)


solve :: Int -> [Int] -> [Int]
solve n xs =
  [m,r]
  where
    m = maximum xs
    m2 = m`div`2
    r = foldr f m (delete m xs)

    f a x | abs(m2-a) > abs(m2-x) = x
          | otherwise             = a