import Data.List (sortBy)
import Data.Ord (comparing)
import Control.Monad (replicateM)
import Control.Applicative ((<$>))

tuplify2 :: [a] -> (a, a)
tuplify2 [x, y] = (x, y)

listfiy2 :: (a, a) -> [a]
listfiy2 (x, y) = [x, y]

victory :: Ord a => [(a, a)] -> (a, a)
victory = head . sortBy (flip $ comparing snd)

main :: IO ()
main = do
    n <- readLn
    a <- replicateM n $ tuplify2 . map (read :: String -> Int) . words <$> getLine
    putStrLn $ unwords $ map show $ listfiy2 $ victory a