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 <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

////////////////*My library*////////////////////////
#define rep_to(a,i,n) for(i=a;i<n;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define rep_r(i,n) for(i=n-1;i>=0;i--)
#define debug_i(x) printf("x:%d\n",x)
#define debug_s(str) printf("str:%s\n",str)
#define debug_c(c) printf("c:%c\n",c)
#define s_i1(x) scanf("%d",&x)
#define s_i2(x,y) scanf("%d %d",&x,&y)
#define s_i3(x,y,z) scanf("%d %d %d",&x,&y,&z)
////////////////////////////////////////////////////
////////////////////////
/*prime()*/
/*primecount()*/
/*sort()*/
///////////////////////

int main()
{
	int i,j,k;
	int n,q;
	int x,y,sd_num=0;
	double max=0,num=0,sd_max=0;
	int a[100000]={},v[100000]={};

	s_i1(n);
	rep(i,n)
	{
		scanf("%d %d",&x,&y);
		//v[x]+=y;
		num=(max<y)? x : num;
		max=fmax(y,max);

		if(max==y)num=fmin(num,x);
	}
	printf("%d %d\n",(int)num,(int)max);
	return 0;
}

C++: #include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "oki.h"

////////////////*My library*////////////////////////
#define rep_to(a,i,n) for(i=a;i<n;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define rep_r(i,n) for(i=n-1;i>=0;i--)
#define debug_i(x) printf("x:%d\n",x)
#define debug_s(str) printf("str:%s\n",str)
#define debug_c(c) printf("c:%c\n",c)
#define s_i1(x) scanf("%d",&x)
#define s_i2(x,y) scanf("%d %d",&x,&y)
#define s_i3(x,y,z) scanf("%d %d %d",&x,&y,&z)
////////////////////////////////////////////////////
////////////////////////
/*prime()*/
/*primecount()*/
/*sort()*/
///////////////////////

int main()
{
	int i,j,k;
	int n,q;
	int x,y,num=0,sd_num=0;
	double max=0,sd_max=0;
	int a[100000]={},v[100000]={};

	s_i1(n);
	rep(i,n)
	{
		scanf("%d %d",&x,&y);
		v[x]+=y;

		num=(max<v[x])? x : num;
		max=fmax(v[x],max);
	}
	printf("%d %d\n",num,(int)max);
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef pair<int, int> p;

void solve()
{
	int n;
	cin >> n;
	vector<p> list(n);
	for(int i = 0; i < n; ++i)
	{
		cin >> list[i].second >> list[i].first;
	}
	sort(list.begin(), list.end());
	int max_point = list[n - 1].first;
	int min_num = 99999;
	for(int i = 0; i < n; ++i)
	{
		if(max_point == list[i].first)
		{
			if(min_num > list[i].second)
			{
				min_num = list[i].second;
			}
		}
	}
	cout << min_num << " " << max_point << endl;
}

int main()
{
	solve();
	return(0);
}

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

int main(){
	int n, a, v, maxa, maxv;
	while (cin >> n) {
		int maxa = 21, maxv = 0;
		for (int i = 0; i < n; i++) {
			cin >> a >> v;
			if (v > maxv) {
				maxv = v;
				maxa = a;
			}
			else if(v == maxv && maxa > a){
				maxa = a;
			}
		}
		cout << maxa << " " << maxv << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdlib>
#include <climits>

using namespace std;

int main () {
  int n;
  cin >> n;

  int maxv = INT_MIN;
  int winner;
  for( int i = 0; i < n; i++ ) {
    int a, v;
    cin >> a >> v;
    if( maxv < v ) {
      winner = a;
      maxv = v;
    }
  }
  cout << winner << " " << maxv << endl;

  return EXIT_SUCCESS;
}

C++: #define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>


using namespace std;
const int MOD = 1000000009; // check!!!
const int INF = 100000000; //1e8

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)(c).size())
#define ten(x) ((int)1e##x)
#define tenll(x) ((ll)1e##x)

struct P{
	int x,y;
	P(){}
	P(int x,int y) : x(x),y(y){}
	bool operator <(const P& p) const { return y != p.y ? y > p.y : x < p.x; }
};

int main(){
	int n; cin>>n;
	vector<P> v(n);
	FOR(i,n) cin>>v[i].x>>v[i].y;
	sort(v.begin(),v.end());
	printf("%d %d\n",v[0].x,v[0].y);

	return 0;
}

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

int main(){
	int n,max=-1,num=-1,a[20],v[20];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i]>>v[i];
		if(max<v[i] && max!=v[i]){
			num=a[i];
			max=v[i];
		}else if(max==v[i] && num>a[i]){
			num=a[i];	
		}
	}
	cout<<num<<" "<<max<<endl;

		return 0;
}

C++: #include<stdio.h>
int fish[21]={0};
int n;
int a,b;
int memo[2]={0};
int date=100;

int main()
{
    scanf("%d",&n);

    for(int i=0;i<n;i++)
    {
        scanf("%d%d",&a,&b);
        if(a<date)date=a;
        memo[0]=date;
        fish[a] +=b;
    }
    for(int i=0;i<21;i++)
    {
        if(fish[i]>memo[1])
        {
            memo[0]=i;
            memo[1]=fish[i];
        }
    }
    printf("%d %d\n",memo[0],memo[1]);
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <iterator>
using namespace std;

int main() {
    int n; cin >> n;
    vector<pair<int, int> > vec;
    while(n--) {
        int a, v; cin >> a >> v;
        vec.push_back(make_pair(v, a));
    }
    auto p = *max_element(begin(vec), end(vec), [](pair<int, int> x, pair<int, int> y) { return x.first != y.first ? x.first > y.first : x.second < y.second; });
    cout << p.second << ' ' << p.first << endl;
}