n = gets.to_i
a = 0
v = 0
while n != 0
  x = gets
  y = x.split()
  y[0] = y[0].to_i
  y[1] = y[1].to_i
  if y[1] > v
    a = y[0]
    v = y[1]
  elsif y[1] == v && y[0] < a
    a = y[0]
  end
  n-=1
  y.clear
end
printf("%d %d\n", a, v)