#include <iostream> using namespace std; int main() { int n,num,g,max_g=0,max_i=0; int grade[100005]={0};//参赛学校编号小于10^5(最后一个测试样例) cin>>n; for(int i=1;i<=n;i++) { cin>>num>>g; grade[num]+=g; if(grade[num]>=max_g) { max_i=num; max_g=grade[num]; } } cout<<max_i<<" "<<grade[max_i]<<endl; return 0; }