import Control.Applicative
import Control.Monad
import Data.List
import qualified Data.Vector as V
import Data.Maybe

main :: IO()
main = do
    _ <- getLine
    as <- map read . words <$> getLine
    putStrLn . disp $ solve as

disp :: (Int, Int) -> String
disp (n, r) = show n ++ ' ' : show r

solve :: [Int] -> (Int, Int)
solve as = fromJust $ lookup maxComb idxedWp
    where
        wp :: [(Int, Int)]
        wp = wholePair as
        combs :: [Int]
        combs = map comb wp
        idxedWp = zip combs wp
        maxComb :: Int
        maxComb = maximum combs

comb :: (Int, Int) -> Int
comb (n, 0) = 1
comb (n, r) = (foldl1' (*) . take r $ reverse [0..n]) `div` (foldl1' (*) [1..r])

wholePair as =  [(n, r) | n <- as, r <- as , n > r]
