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 <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=10000009;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };


int main() {
	int n,a[25],v[25],b[25];
	int j[25]={};
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i]>>v[i];
		b[a[i]-1]=v[i];
	}
	sort(b,b+n);
	for(int i=0;i<n;i++){
		if(v[i]==b[n-1]){
			j[a[i]]++;
		}
	}
	for(int i=1;i<=n;i++){
		if(j[i]!=0){
			cout<<i<<" "<<b[n-1]<<endl;
		}
	}
}

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

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef pair<int,int> P;
typedef complex<double> CP;
typedef long long ll;

int n;
P res;

int main(){
	cin>>n;
	int a,v;
	res.F=1; res.S=0;
	rep(i,n){
		cin>>a>>v;
		if(res.S<v||(res.S==v&&a<res.F)){
			res.F=a; res.S=v;
		}
	}
	cout<<res.F<<" "<<res.S<<endl;
	return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(o) {cerr<<#o<<" "<<o<<endl;}
#define DUMPC(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

bool cmp(pii a, pii b) {
	return a.second == b.second ? a.first<b.first : a.second>b.second;
}

signed main() {
	int n; cin >> n;
	vector<pii> a(n);
	REP(i, n)cin >> a[i].first >> a[i].second;
	sort(ALL(a), cmp);
	cout << a[0].first << " " << a[0].second << endl;
	return 0;
}

C++: #include <iostream>
using namespace std;
 
int main()
{
  int n;
  int min = 21, max = 0;
  int a, v;

  cin >> n;
  for (int i = 0; i < n; i++){
    cin >> a >> v;
    if (max < v){
      max = v;
      min = a;
    }
    else if (max == v){
      if (w1 > a){
        min = a;
      }
    }
  }
  cout << w1 << ' ' << max << endl;
  return (0);
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int n,a[21],b,c,d=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>b>>c;
		a[b]=c;
		if(d<c)
			d=c;
	}
	int i=1;
	while(true){
		if(a[i]==d){
			cout<<i<<" "<<a[i]<<endl;
			break;
		}
		i++;
	}
    return 0;
}

C++: #include<stdio.h>

int main(){

int x,y,n;
int X=0,Y=0;


scanf("%d",&n);

for(int i=0;i<n;i++)
{
scanf("%d %d",&x,&y);
if(Y<y){X=x;Y=y;}
else if(Y==y&&x<X){X=x;Y=y;}

}

printf("%d %d\n",X,Y);
return 0;
}

C++: // #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>	// istringstream
using namespace std;

int main(){
	int n, ansBangou = 0, maxNum = -1;
	int bangou = 0, num = -1;

	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> bangou >> num;
		if (maxNum < num){
			maxNum = num;
			ansBangou = bangou;
		}
		else if (maxNum == num){
			ansBangou = min(ansBangou, bangou);
		}
	}
	cout << ansBangou << " " << maxNum << endl;

	return 0;
}

C++: #include <cstdio>
#include <algorithm>

using namespace std;

int main(){
	int n;
	int a, b;
	int v[110] = {0}, v2[110] = {0};
	
	scanf("%d", &n);
	
	for (int i = 1; i <= n; i++){
		scanf("%d %d", &a, &b);
		v[a] = b;
		v2[a] = b;
	}
	
	sort(v, v + n + 1);
	reverse(v, v + n + 1);
	
	for (int i = 0; i <= n; i++){
		if (v2[i] == v[0]){
			printf("%d %d\n", i, v2[i]);
			break;
		}
	}
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,m=0;cin >> n;
  int d[21]={};
  int a,v;
  while(n--){
    cin >> a >> v;d[a]=v;
    if(d[m]<d[a])m=a;
  }
  cout << m << " " << d[m] << endl;
}

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

  int n,a[20],v[20],b=0;

  cin >>n;

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

  for(int i=0 ; i < n ; i++){
    if(v[b] < v[i]){
      b=i;
    }else if(v[b] == v[i] && a[b] > a[i]){
      b=i;
    }
    
  }
  
  cout <<a[b]<<" "<<v[b]<<endl;

  return 0;
}

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

int main(){
	int n, a, v, maxa, maxv;
	while (cin >> n) {
		for (int i = 0; i < n; i++) {
			cin >> a >> v;
			if (v > maxv) {
				maxv = v;
				maxa = a;
			}
			else if(v == maxv && maxa > a){
				maxv = v;
				maxa = a;
			}
		}
		cout << maxa << " " << maxv << 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;
		int ans=0,ansi=10000;
	for(int i=0;i<n;i++){
	int a,b;
	cin>>a>>b;
	if(ans<b)ans=b,ansi=a;
	if(ans==b)ansi=min(ansi,a);
	}


	cout<<ansi<<" "<<ans<<endl;
	return 0;
}

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

int main(void){
  int n,num,w;
  pair<int,int> p[20];  

  cin >> n;
  for(int i = 0 ; i < n ; i++){
    cin >> num >> w;
    p[num-1].first = num;
    p[num-1].second = w;
  }

  sort(p,p+n);
  cout << p[0].first << ' ' << p[0].second << endl;

  return 0;
}

C++: #include <iostream>
int main(void){
  int n,a,b,max=0,c=21;
  std::cin>>n;
  for(int i=0;i<n;i++){
    std::cin>>a>>b;
    if(max<=b){
      if(max==b){
	if(c>a)c=a;
	continue;
      }
      max=b;
      c=a;
    }
  }
  std::cout<<c<<" "<<max<<'\n';
  return 0;
}