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++: #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

int main() {
	int n; cin >> n;
	
	//-匹数, 番号
	vector<PII> a(n);
	rep(i, n) {
		int x, y; cin >> x >> y;
		a[i] = mp(-y, x);
	}
	sort(all(a));

	Cout2(a[0].second, -a[0].first);
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m=0,a,b=100,d;
  cin>>n;
  while(n--){
    cin>>d>>a;
    if(m<a)b=d;
    m=max(m,a);
    if(d<b)b=d;
  }
  cout<<b<<' '<<m<<endl;
}

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

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

int main()
{
    int n, index, w, idx = 0, mx = -1;
    cin >> n;

    for(int i=0;i < n; ++i) {
        cin >> index >> w;
        if (mx < w || (mx == w && idx > index)) idx = index, mx = w;
    }

    cout << idx << " " << mx << 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;
			mnum = num;
		}
		if (nf == mnf && num < mnum) mnum = num;
	}
	cout << mnum << " " << mnf << endl;

	return 0;
}

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

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

		return 0;
}

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

int main()
{
    int n, index, w, idx = 0, mx = -1;
    cin >> n;

    for(int i=0;i < n; ++i) {
        cin >> index >> w;
        if (mx < w || (mx == w && idx > index)) idx = index-1, mx = w;
    }

    cout << idx+1 << " " << mx << endl;

    return 0;
}

C++: //
//  main.cpp
//  ggggggggggggggggggggggggggggggggggggg
//
//  Created by h3037175 on 2017/08/01.
//  Copyright ?? 2017??´ h3037175. All rights reserved.
//

#include <iostream>
using namespace std;
int main() {
    int n,a,v,max=-100000,num;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a>>v;
        if(max>v){
            max=v;
            num=a;
        }
    }
    cout<<num<<" "<<max<<endl;
    return 0;
}

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

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

void solve(vector<P> v) {
	int minID, maxNum;
	minID = v[0].first;
	maxNum = v[0].second;
	for (int i = 1; i < v.size(); i++) 
		if (v[i].second > maxNum || (v[i].second == maxNum && v[i].first < minID)) {
			minID = v[i].first;
			maxNum = v[i].second;
		}

	cout << minID << " " << maxNum << endl;
}


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n, a, v;
	cin >> n;
	vector<P> fish;
	for (int i = 0; i < n; i++) {
		cin >> a >> v;
		fish.push_back(P(a, v));
	}
	solve(fish);
}

C++: #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


signed main(){
  int n;
  cin>>n;
  vector<pair<int,int>> p;
  REP(i,n){
    int a,v;
    cin>>a>>v;
    p.PB(MP(v,a));
  }
  sort(ALL(p));
  int maxi=p.back().FR;
  int par=p.back().SC;
  for(int i=p.size();i>=0;i--){
    if(p[i].FR==maxi)par=p[i].SC;
    else break;
  }
  cout<<par<<' '<<maxi<<endl;
  return 0;
}

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

int main()
{
	int n, a, v,maxa,maxv;
	cin >> n;
	maxa = 0;
	maxv = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a >> v;
		if ((maxv < v) || (a < maxa && v==maxv))
		{
			maxa = a;
			maxv = v;
		}
	}

	cout << maxa << ' ' << maxv << endl;

	return 0;
}

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

int main(){
	int n;	//参加者数
	cin >> n;

	int* a; //参加者番号
	int* v; //匹数
	a = new int[n];
	v = new int[n];
	for (int i = 0; i < n; i++){
		cin >> a[i] >> v[i];
	}

	int winner = a[0];
	int max = v[0];

	for (int i = 1; i < n; i++){
		if (v[i]>max){
			winner = a[i];
			max = v[i];
		}
		else if (v[i] == max && a[i] < winner){
			winner = a[i];
		}
	}

	cout << winner << " " << max << endl;
	return 0;
}

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

C++: #include <iostream>
using namespace std;
int main(){
	int n[20],num,a[20],z,max=0;
	cin>>num;
	for(int i=0;i<num;i++){
		cin>>a[i]>>n[i];
		if(max<n[i]){
			max=n[i];
			z=i;
		}else if(max==n[i]){
			if(a[z]>a[i])z=i;
		}
	}
	cout<<a[z]<<" "<<n[z]<<endl;
	return 0;
}

C++: #include <iostream>
#include <utility>
#include <algorithm>
#include <functional>

using namespace std;

int main() {
    int n;
    pair<int, int> member[20];
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> member[i].second >> member[i].first;
    }
    sort(member, member + n, greater<pair<int, int> >());
    cout << member[0].second << " " << member[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){X=x;Y=y;}
else if(Y<y){X=x;}

}

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

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

using namespace std;

int main() {
	int n, max = 0;
	cin >> n;
	vector<pair<int, int> > pairs(n);
	for (int i = 0; i < n; i++) {
		int a, v;
		cin >> a >> v;
		pairs[i] = make_pair(a, v);
	}
	sort(pairs.begin(), pairs.end());

	for (int i = 0; i < n; i++) {
		max = pairs[i].second > pairs[max].second? i: max;
	}
	cout << pairs[max].first << ' ' << pairs[max].second << endl;
	return 0;
}

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