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<cstdio>

int n;
int a[21],v[21];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d%d",&a[i],&v[i]);
	int mid=a[0],m=v[0];
	for(int i=1;i<n;i++){
		if(m<v[i]){
			mid=a[i];
			m=v[i];
		}
		if(m==v[i] && mid>a[i])mid=a[i];
	}
	printf("%d %d\n",mid,m);
	return 0;
}

C++: #include <iostream>

using namespace std;

int info[21];

int main()
{
    int n, a, v;
    int max_idx = 0;

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> a >> v;
        info[a] = v;
    }
    
    for (int i = 1; i <= n; i++)
        if (info[max_idx] < info[i])
            max_idx = i;
    for (int i = 1; i <= n; i++)
        if (info[max_idx] == info[i])
            cout << i << " " << info[i] << endl;

    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<pair<int ,int> > a(n);

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

  int max = -1;
  int min_num = 9999;
  for(int i = 0; i < n; i++) {
    if(max < a[i].second) {
      max = a[i].second;
    }
  }

  for(int i = 0; i < n; i++) {
    if(max == a[i].second && min_num > a[i].first) {
      min_num = a[i].first;
    }
  }

  cout << min_num << " " << max << endl;

  return 0;
}

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
pair<int,int> v[20];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++){
		int b,c;
		scanf("%d%d",&b,&c);
		v[i]=make_pair(-c,b);
	}std::sort(v,v+a);
	printf("%d %d\n",v[0].second,-v[0].first);
}

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

int main()
{
    int n;
    int p[21] = {};

    cin >> n;

    int max = 0;
    for( int i = 1; i <= n; i++ )
    {
        int t;
        cin >> t >> p[t];
        if( max < p[t] )
            max = p[t];
    }
    
    int min = 1000;
    for( int i = 1; i <= 20; i++ )
    {
        if( p[i] == max && i < min )
            min = i;
    }

    cout << min << " " << max;

    return 0;
}

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

typedef pair<int,int> P;

int main(){
    int n;
    cin>>n;
    vector<P> data(n);
    for(int i=0; i<n; i++) {
        int a, v;
        cin>>a>>v;
        data.push_back(make_pair(-v,a));
    }
    sort(data.begin(),data.end());
    cout<<data[0].second<<" "<<-data[0].first<<endl;
}

C++: //Surf Smelt Fishing Contest
#include<bits/stdc++.h>
using namespace std;

vector<pair<int, int> > v;

bool comp(const pair<int, int> &a, const pair<int, int> &b){
  if(a.second==b.second)return a.first<b.first;
  return a.second>b.second;
}

int main(){
  int n;
  cin>>n;
  for(int i=0; i<n; i++){
    int a, b;
    cin>>a>>b;
    v.push_back(make_pair(a, b));
  }
  sort(v.begin(), v.end(), comp);
  cout<<v[0].first<<' '<<v[0].second<<endl;
  return 0;
}

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

int main() {
	
	int n;
	int p[20]={};
	int a,v;
	int max=0;
	
	cin>>n;
	for(int i=0;i<n;++i){
		cin>>a>>v;
		
		p[a] = v;
		if(v>max)max=v;
	}
	
	for(int i=0;i<n;++i){
		if(p[i]==max)cout<<i<<" "<<p[i]<<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){
			max = b;
			if(max < b) num = a;
			else if(num > a) num = a; 
		}
	}
	printf("%d %d\n", num, max);
	return 0;
}

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

int main() {
  int n, a, b, max_a, max_b;
  scanf("%d", &n);
  max_a = max_b = 0;
  for (int i=0; i<n; i++) {
    scanf("%d %d", &a, &b);
    if (max_b < b) {
      max_b = b;
      max_a = a;
    }
  }
  printf("%d %d\n", max_a, max_b);
  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[i] = make_pair(-w,num);
  }
  sort(p,p+n);
  cout << p[0].second << ' ' << p[0].first << endl;

  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}
}

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

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


int main() {
    int n;
    while(cin>>n){
        int maxnum=-1,maxi=-1;
        rep(i,n){
            int a,b;
            cin>>a>>b;
            if(b>maxi){
                maxi=b;
                maxnum=a;
            }
        }
        cout<<maxnum<<" "<<maxi<<endl;
    }
    
    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){X=x;}
else if(Y<y){X=x;Y=y;}

}

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

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int n, a, v;
vector<P> vp;

bool flag(P a, P b){
	if (a.se == b.se)return a.first < b.first;
	return a.second > b.second;
}
int main(){
	cin >> n;
	int max = -1, pa = 20;
	REP(i, n){
		cin >> a >> v;
		vp.push_back(P(a, v));
	}
	sort(ALL(vp), flag);
	cout << vp[0].first << " " << vp[0].second << endl;
}

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(i==0) {
			maxa = a; maxv = 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>
using namespace std;

int main(void){

  int n;
  int a[20];
  int v[100];
  int max = 0;
  int num = 0;

  cin >> n;

  for( int i = 0 ; i < n ; i++ ){

    cin >> a[i] >> v[i];

    if( max < v[i] ){
      
      max = v[i];
      num = a[i];
    }

  }

  cout << num << " " << max << endl;

  return 0;

}