n = $stdin.gets.to_i

data = Array.new
n.times do
  data << $stdin.gets.chomp.split(" ").map(&:to_i)
end

data.sort!{|a1, a2| a2[1] <=> a1[1]}.select!{|d| d[1] == data[0][0]}.sort!
printf "%d %d\n", data[0][0], data[0][1]