Go: package main

import (
    "fmt"
    "sort"
)

type Player struct {
    Name int
    Score  int
}

type Place []Player

func (p Place) Len() int {
    return len(p)
}

func (p Place) Swap(i, j int) {
    p[i], p[j] = p[j], p[i]
}

func (p Place) Less(i, j int) bool {

	if p[i].Score == p[j].Score {
		return p[i].Name < p[j].Name
	} else {
		return p[i].Score > p[j].Score
	}
   
}

func DataEntry(n int) Place {
	var id, sc int
	var ranking Place
	var adding Player

	for i := 0; i < n; i++ {

		fmt.Scan(&id, &sc)

		adding.Name = id
		adding.Score = sc

		ranking = append(ranking, adding)
	}

	return ranking
}

func main() {
	var ranking Place
	var num int

		fmt.Scan(&num)
		ranking = DataEntry(num)
	
	sort.Sort(Place(ranking))
	fmt.Println(ranking[0].Name ,ranking[0].Score)
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>
#include <bitset>
#include <cassert>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int dy[]={-1,0,1,0},dx[]={0,1,0,-1};
// adjust problem by problem
const double EPS=1e-8;
const double PI=acos(-1.0);
#ifdef __GNUC__
int popcount(int n){return __builtin_popcount(n);}
int popcount(ll n){return __builtin_popcountll(n);}
#endif
#ifndef __GNUC__
template<class T> int popcount(T n){int cnt=0;while(n){if(n%2)cnt++;n/=2;}return cnt;}
#endif
template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void PrintSeq(T &a,int sz){for(int i=0;i<sz;i++){cout<<a[i];if(sz==i+1)cout<<endl;else cout<<' ';}}
bool EQ(double a,double b){return abs(a-b)<EPS;}
void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}
vector<string> split(string str,char del){
  vector<string> res;
  for(int i=0,s=0;i<SIZE(str);i++){
    if(str[i]==del){if(i-s!=0)res.push_back(str.substr(s,i-s));s=i+1;}
    else if(i==SIZE(str)-1){res.push_back(str.substr(s));}
  }
  return res;
}

int main(){

  int N;
  cin>>N;
  map<int,int> m;
  for(int i=0;i<N;i++){
    int a,b;
    cin>>a>>b;
    m[a]+=b;
  }
  vector<pii> v;
  for(map<int,int>::iterator it=m.begin();
      it!=m.end();it++){
    v.push_back(pii(-it->second,it->first));
  }
  sort(v.begin(),v.end());
  cout<<v[0].second<<" "<<v[0].first*-1<<endl;

  return 0;
}

C++: #include<iostream>
#include<algorithm>
 
using namespace std;
 
int main(){

    int n, p, fish;
    cin >> n;

    int rp = 20; 
    int max_fish = -100;

    for( int i = 0; i < n ; i++ ){
      
      cin >> p >> fish;
      
      if(max_fish < fish || max_fish == fish && rp > p){
	
        rp = p;
        max_fish = fish;
      }
    }
    cout << rp << " " << max_fish << endl;
    return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
	int num;
	cin >> num;
	int a,v,maxa=0,maxv=0;
	for(int i=0;i<num;i++){
		cin >> a >> v;
		if(maxv < v){
			maxv = v; maxa = a;
		}
		if(maxv == v){
			if(maxa>a){
				maxv = v; maxa = a;
			}
		}
	}
	cout << maxa << " " << maxv << endl;
}

C++: #include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
using namespace std;
int main(){
int n;
cin>>n;
vector<int>in;
vector<int>no;
rep(i,n){
int a,b;
cin>>a>>b;
pb(in,b);
pb(no,a);
}
rep(i,100*n){
rep(j,n-1){
if(in[j]<in[j+1]){swap(in[j],in[j+1]);swap(no[j],no[j+1]);}
if(in[j]==in[j+1]&&no[j]>no[j+1])swap(no[j],no[j+1]);
}
}
cout<<no[0]<<" "<<in[0]<<endl;
}

C++: #include <iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int max=-1; int kouho =0;
    for(int i=0;i<n;i++){
        int a,b;
        cin >> a >> b;
        if(max < b){
            max = b;
            kouho = a;
        }
    }
    cout << kouho << " " << max << endl;
}

C++: #include <iostream>
using namespace std;
int main(){
  int n,a,b,max = 0,ans;
  cin >> n;
  while(n--){
    cin >> a >> b;
    if(max < b ){
      max = b;
      ans = a;
    }else if(max == b && ans > a ){
      ans = a;
    }
  }
  cout << ans << " " << max << endl; 
}

C++: #include <iostream>
using namespace std;

int main(){
	int n,max,num,a[20],v[20];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i]>>v[i];
	}
	max=v[0];num=1;
	for(int i=1;i<n;i++){
		if(max<v[i]){
			if(max!=v[i]){//MAX??????????????§???????????°?????????????????????????????????
				num=i+1;//??????????????¬????????§??????
			}
			max=v[i];
		}
	}
	cout<<num<<" "<<max<<endl;

		return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
	
	int n;
	int a,b;
	
	cin >> n ;
	cin >> a >> b ;
	
	int max=b,num=a;
	
	for( int i=1 ; i<n ; i++ ){
		cin >> a >> b ;
		if( max < b ){
			max=b;
			num=a;
		}
		else if( max == b && num > a ) num=a;
	}
	
	cout << num << " " << max << endl ;
	
return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,s,d,f,g,i;
	f=-1;
	g=0;
	scanf("%d",&a);
	for(i=1;i<=a;i++){
		scanf("%d %d",&s,&d);
		if(f==d){
			if(g>s){
				g=s;
			}
		}
		else if(f<d){
			f=d;
			g=s;
		}
	}
	printf("%d %d\n",g,f);
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
	int data[21],n,v,a;
	int max[2];
	max[1]=0;
	memset(data,0,sizeof(data));
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>v;
		data[a]+=v;
		if(data[a]>max[1]){
			max[0]=a;
			max[1]=data[a];
		}
	}
	cout<<max[0]<<" "<<max[1]<<endl;
}

C++: #include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#define rep(i,a,n) for(int i=a;i<n;i++)
using namespace std;

int main(void){
	int n,m,a[1000],max=0;
	a[0]=-1;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> m;
		cin >> a[m];
	}
	rep(i,0,n){
		if(max<a[i]){
			max=a[i];
		}
	}
	rep(i,0,n){
		if(max == a[i]){
			cout << i << " " << a[i] << "\n";
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;

int main()
{
	int n, a, v,maxa,maxv;
	cin >> n;
	maxv = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a >> v;
		if ((maxv < v) || (a < maxa && v==maxv))
		{
			maxa = a;
			maxv = v;
		}
	}

	cout << maxa << ' ' << maxv << endl;

	return 0;
}

C++: #include <iostream>
using namespace std;

int main(){
  int n;

  while(cin >> n){
    int minA, maxV = -1;

    for(int i = 0; i < n; i++){
      int a, v;
      cin >> a >> v;

      if(maxV < v || maxV == v && minA > a){
        minA = a;
        maxV = v;
      }
    }

    cout << minA << " " << maxV << endl;
  }
}