水水~
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+10;
struct Node
{
int v;
int w;
Node(int i,int j):v(i),w(j){}
};
map<int,int>m;
int cmp(const Node & c,const Node & d)
{
return c.w>d.w;
}
int main()
{
int n;
int s,t;
int Max = 0;
int MaxNum = 1;
cin>>n;
for(int i = 0;i<n;i++)
{
cin>>s>>t;
if(m.count(s)) m[s] = m[s]+t;
else m[s] = t;
if(m[s]>Max)
{
Max = m[s];
MaxNum = s;
}
}
cout<<MaxNum<<" "<<Max<<endl;
return 0;
}
/**
6
3 65
2 80
1 100
2 70
3 40
3 0
**/