import Control.Monad
import Data.List
import Text.Printf

main = do
    n <- readLn :: IO Int
    ss <- replicateM n getLine
    let lst = map (\l->(l!!0,l!!1)) $ map (\s->map (\x->read x::Int) $ words s) ss
    let (id,num) = last $ sortBy (\x y->compare (snd x) (snd y)) lst
    printf "%d %d\n" id num