#include <iostream>
#include <string.h>
using namespace std;
const int maxN = 999999;
int main(){
int school[maxN];
int n,schID, score;
cin >> n;
for(int i = 0; i < n; i++){
cin >> schID >> score;
school[schID] += score;
}
int k = 1, Max = -1;
for(int i = 1; i <= n; i++){
if(school[i] > Max){
Max = school[i];
k = i;
}
}
cout << k << " " << Max << endl;
return 0;
}
03-02
388
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-26
3723
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)