import scala.io.StdIn.{readInt,readLine}

object Main extends App {
  val n = readInt
  val list = for(i <- 0 until n) yield readLine.split(" ").map(_.toInt)
  val sorted = list.sortWith( (x,y) => if( x(1) == y(1) ) x(0) < y(0) else x(1) > y(1) )
  println(sorted(0)(0) + " " + sorted(0)(1))
}