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>
int a,v,M,A=99;main(){for(std::cin>>a;std::cin>>a>>v;)M<=v&&(M=v)&(A=a);std::cout<<A<<" "<<M<<"\n";}

C++: #include<cstdio>
using namespace std;
int main(void)
{
    int n,a,b,i,max,x;
    scanf("%d",&n);
	max=0;
    for(i=0;i<n;i++){
        scanf("%d %d",&a,&b);
        if(max<=b){
            if(max<b){
                x=a;
                max=b;
            }
			else if(x>a)x=a; 
		}
    }
    printf("%d %d\n",x,max);
    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <math.h>
#include <string>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <cstring>
#include <sstream>
#include <stdlib.h>

using namespace std;

int main (void)
{
	int n,a[20],b[20];
	cin >> n;

	long gg = 1000;

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

	int co = 0;

	for (int i = 0; i < n; i++)
	{
		if (co < b[i])
		{
			co = 0;
			co = b[i];
			gg = 0;
			gg = a[i];
		}
		if (co == b[i])
		{
			if (a[i] < gg)
			{
				gg = 0;
				gg = a[i];
			}
		}
	}

	cout << gg << " " << co << endl;
}

C++: #include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <time.h>
#include <cstdio>
using namespace std;
int main(){
	int n;
	cin >> n;
	vector< pair<int,int> > v;
	for(int i = 0 ; i < n ; i++){
		int a,b;
		cin >> a >> b;
		v.push_back(make_pair(-b,a));
	}
	sort(v.begin(),v.end());
	cout << v[0].second << " " << v[0].first * (-1) << endl;
}

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

using namespace std;

int main(){
	
	int n, dummy1, dummy2, max, ans;
	
	int v[1000];
	
	cin >> n;
	
	for(int i = 1; i <= n; i++){
		v[i] = 0;
	}
	
	for(int i = 1; i <= n; i++){
		cin >> dummy1 >> dummy2;
		v[dummy1] = dummy2;
	}
	
	max = 0;
	
	for(int i = n; i > 0; i--){
		if(v[i] >= max){
			ans = i;
			max = v[i];
		}
	}
	
	printf("%d %d\n", ans, v[ans]);
	
	return 0;
}

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

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

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

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, res[20][2];
    cin >> n;
    rep(i,n){
        cin >> res[i][0] >> res[i][1];
    }
    int max = 0, j;
    rep(i,n){
        if(max < res[i][1]){
            max = res[i][1];
            j = i;
        }
    }
    cout << res[j][0] << ' ' << res[j][1] << endl;
}

C++: #include <bits/stdc++.h>
#define range(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) range(i,0,n)
using namespace std;

int n;
int a[110];
int main(void){
	cin >> n;
	rep(i,n){
		int idx,num;
		cin >> idx >> num;
		a[idx-1]=num;
	}
	int ans=max_element(a,a+n)-a;
	cout << ans+1 << " " << a[ans] << endl;
	return 0;
}

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

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

using namespace std;

int main() {
    int n; cin >> n;
    vector<P> Ps;
    for (int i = 0; i < n; i++) {
        P p; cin >> p.x >> p.y;
        Ps.push_back(p);
    }
    sort(Ps.begin(), Ps.end());
    cout << Ps[0].x << ' ' << Ps[0].y << endl;
    return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

int main(){
	int n,a,v;
	pii d[25]={};
	cin>>n;
	rer(i,1,n) d[i].se=i;
	rep(i,0,n){
		cin>>a>>v;
		d[a].fi=v;
	}
	sort(d+1,d+n+1);
	rer(i,1,n){
		if(d[i].fi==d[n].fi){
			o(d[i].se<<" "<<d[i].fi); break;
		}
	}
}

C++: #include<iostream>
int a,v,A,V;main(){for(std::cin>>A;std::cin>>a>>v;)if(V<v||V==v&A>a)V=v,A=a;std::cout<<A<<" "<<V<<"\n";}

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;

int main(){
	cin >> n;
	int max = -1, pa = -1;
	REP(i, n){
		cin >> a >> v;
		if (v > max){
			max = v;
			pa = a;
		}
	}
	cout << pa << " " << max << endl;
}

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

int main() {
    int n;
    cin >> n;
    vector<pair<int,int>> list;
    for (int i=0; i<n; ++i) {
        int a, v;
        cin >> a >> v;
        list.push_back(make_pair(-v, a));
    }
    sort(list.begin(), list.end());
    cout << list[0].second << " " << -list[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(i=0){Y=y;X=x;}
if(Y==y&&x<X){X=x;Y=y;}
else if(Y<y){X=x;Y=y;}

}

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

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

int main(){

  int n;
  int ma,mv;
  int a,v;

  scanf("%d",&n);
  ma=mv=0;

  for(int i=0;i<n;i++){
    scanf("%d %d",&a,&v);
    if(v>mv){
      ma=a;
      mv=v;
    }
  }

  printf("%d %d\n",ma,mv);

  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<double,int> p;

int main(){
    vector<p> v;
    int n,num,data,m;
    
    cin >> n;
    m = n;
    while(n--){
        cin >> num >> data;
        v.push_back(p(data,num));
    }
    stable_sort(v.begin(),v.end());
    cout << v[m-1].second << ' ' << v[m-1].first << endl;
    
    return 0;
}

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

typedef pair<int, int> P;

bool compare(P v1, P v2){
  if(v1.second > v2.second) return true;
  else if(v1.second < v2.second) return false;
  else{
    if(v1.first < v2.first) return true;
    else return false;
  }
}
  
int main(){
  vector<P> v;
  int n;
  cin >> n;
  P t;
  for(int i = 0 ; i < n ; i++){
    cin >> t.first >> t.second;
    v.push_back(t);
  }

  sort(v.begin(), v.end(), compare);
  
  cout << v[0].first << ' ' << v[0].second << endl;
  return 0;
}