n = $stdin.gets.to_i

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

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