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<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int n, r[2];
    int max = 0, num = 20;
    cin >> n;
    rep(i,n){
        cin >> r[0] >> r[1];
        if(max <= r[1]){
            max = r[1];
            num = r[0];
            if(num >= r[0]){
                num = r[0];
            }
        }
    }
    cout << num << ' ' << max << endl;
}

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

int main() 
{
	map<int, int>s;
	int a;
	cin >> a;
	for (int b = 0; b < a; b++) {
		int c, d;
		cin >> c >> d;
		s.insert (pair<int, int>(d, c));
	}
	auto e = s.end();
	e--;
	cout << e->second << " " << e->first << endl;
}

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

int main(){

  int n, a, v, m_a, m_v;

  cin >> n;

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

    if(v >= m_v){
      if(v == m_v && a > m_a) break;
      m_a = a;
      m_v = v;
    }
  }

  cout << m_a << " " << m_v << endl;

  return 0;

}

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

int main(){
  int n,a,v[100],i,num=0,top;
  cin >> n;
  for(i=0;i<n;i++){
    cin>>a>>v[i];
  }
  top=v[0];
  for(i = 0;i<n;i++){
    num++;
    if(top<v[i]){
      top=v[i];
    }
  }
    cout << num<<" "<<top<<endl;
    return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
int main(){
	int ta[10000]={0},n;
	cin>>n;
	for(int i=0;i<n;i++){
	int a,b;
	cin>>a>>b;
	ta[a]+=b;
	}
	int ans=0,ansi=0;
	for(int i=0;i<10000;i++){
	if(ans<ta[i])ans=ta[i],ansi=i;
	if(ans==ta[i])ansi=min(ansi,i);
	}
	cout<<ansi<<" "<<ans<<endl;
	return 0;
}

C++: #include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef pair<int, int> P;

int main() {
  int N; cin >>N;
  vector<P> v(N);
  REP(i, N) cin >>v[i].first >>v[i].second;
  sort(v.begin(), v.end(), [](const P &a, const P &b) -> bool { return (a.second != b.second ? a.second > b.second : a.first < b.first); });
  cout <<v[0].first <<" " <<v[0].second <<endl;
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main()
{
  typedef pair<int, int> P;
  int n; cin >> n;
  vector<P> av(n);
  for(P &p : av) cin >> p.second >> p.first, p.first *= -1;
  sort(av.begin(), av.end());
  cout << av[0].second << " " << -av[0].first << endl;
  return 0;
}

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

int main() {
	int n, nf, num, mnf, mnum;

	cin >> n;
	cin >> mnum >> mnf; n--;
	while (n--) {
		cin >> num >> nf;
		if (nf >= mnf) {
			mnf = nf;
			if (num < mnum) mnum = num;
		}
	}
	cout << mnum << " " << mnf << endl;

	return 0;
}

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

C++: #include<stdio.h>
 
int main(){
	int n, a, b, i, max = 0, num;
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		scanf("%d %d", &a, &b);
		if(max <= b){
			if(max < b){
				num = a;
				max = b;
			}else if(num > a) num = a; 
		}
	}
	printf("%d %d\n", num, max);
	return 0;
}

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

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

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