#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <sstream>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
	int a, v, n;
	int max_v = -1;
	int max_a = -1;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif

#if INPUT_FROM_FILE
	ifs >> n;
#else
	std::cin >> n;
#endif

	for(int i = 0; i < n; i++){
#if INPUT_FROM_FILE
		ifs >> a >> v;
#else
		std::cin >> a >> v;
#endif
		if(max_v < v){
			max_v = v;
			max_a = a;
		}
		else if(max_v == v && max_a > a){
			max_a = a;
		}
	}
 
	std::cout << max_a << " " << max_v << std::endl;

#if INPUT_FROM_FILE
	//fclose(fp);
#endif
    return 0;
}
