
import std.stdio;
import std.algorithm;
import std.conv;
import std.string;
import std.array;

int[] read_nums() {return readln.strip.chomp.split(" ").map!(to!(int)).array;}

void main() {
  int times = readln.chomp.to!(int);
  int index = -1;
  int max = -1;
  foreach(t; 0..times) {
    int[] result = read_nums;
    if (result[1] > max) {
      max = result[1];
      index = result[0];
    }
    else if (result[1] == max && result[0] < index)
      index = result[0];
  }
  writeln(index, " ", max);
}