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>

using namespace std;

int main()
{
 int n;
 int a[20], v[20];
 scanf("%d", &n);

 for (int i = 0; i < n; i++) scanf("%d %d", a + i, v + i);

 int ai = 9999, vi = -1;

 for (int i = 0; i < n; i++){
  if (v[i] > vi){
    vi = v[i];
    if (ai > a[i]) ai = a[i];
  }
  else if (v[i] == v[i]){
    if (ai > a[i]) ai = a[i];
  }
 }
 return (!printf("%d %d\n", ai, vi));
}

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

int main(){
	int n=0;
	cin>>n;
	int dt[n+1];
	for(int i=0;i<n+1;i++){
		dt[i]=0;
	}
	for(int i=0;i<n;i++){
		int a,b;
		cin>>a>>b;
		dt[a]=b;
	}
	int maximum=0,cnt=0;
	for(int i=1;i<=n;i++){
		if(maximum<dt[i]){
			maximum=dt[i];
			cnt=i;
		}
	}
	cout<<cnt<<" "<<maximum<<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 (min > a){
        min = a;
      }
    }
  }
  cout << min << ' ' << max << endl;
  return (0);
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 99999999;

#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)

typedef long long ll;

using namespace std;



/*
class TheKingsArmyDiv2
{
public:
	int getNumber(vector <string> state)
	{

	}
};
*/




int main()
{
	int n;
	
	cin >> n;
	pair<int, int> va[n];
	
	REP(n)
	{
		cin >> va[i].second >> va[i].first;
	}
	
	sort(va, va + n);
	
	cout << va[n - 1].second << " " << va[n - 1].first << endl;
	
	return 0;
}

C++: #include <iostream>

using namespace std;

int p[20];
int fish[20];

void bubble_sort_fish(int n){

  for( int i = 0 ; i < n - 1 ; i++ ){
    for( int j = n - 1 ; j > i ; j-- ){
      if( fish[j-1] > fish[j] ){

	int temp1 = fish[j];
	fish[j] = fish[j-1];
	fish[j-1] = temp1;

	int temp2 = p[j];
	p[j] = p[j-1];
	p[j-1] = temp2;

      }
    }
  }
}

int main(void){

  int n;

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

  bubble_sort_fish(n);//ただのバブルソートの練習、とくに意味はない。
  //  for( int i = 0 ; i < n; i++ )cout << p[i] << "---" << fish[i] << endl;
  //確認のアウトプット
  //以下がアルゴリズム
  int max_fish = 0;
  int min_p = 20;
  for( int i = n - 1 ; i >= 0 ; i-- ){
    if( max_fish < fish[i] && min_p > p[i] ){
      max_fish = fish[i];
      min_p = p[i];
    }
  }
  cout << min_p << " " << max_fish << endl;
}

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

C++: #include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main()
{
	int n;
	cin >> n;
	
	vector< pair<int,int> > res;
	rep(i,n)
	{
		int a,v;
		cin >> a >> v;
		res.push_back(pair<int,int>(v,a));
	}

	sort(res.begin(),res.end(),greater<pair<int,int> >());
	int min_num = 21;
	rep(i,n)
	{
		if(res[0].first == res[i].first)
		{
			min_num = min(min_num,res[i].second);
		}
	}

	cout << min_num << " " << res[0].first << endl;
	return 0;
}

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

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

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
   long long int n,men,fish,num,fishmax;
   cin>>n;
   for(int i=0;i<n;i++){
    cin>>men>>fish;
    if(i==0){
        num=men;
        fishmax=fish;
    }
    else {
        if(fish>fishmax){
            fishmax=fish;
            num=men;
        }
        else if(num>men)num=men;
    }
   }
   cout<<num<<" "<<fishmax<<endl;
}

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

C++: #include <iostream>

using namespace std;

int main(){

	int n;
	int ary[101] , v[101];

	cin >> n;

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

	for(int i = 0; i < n; i++){
		for(int j = 1; j < n-1; j++){
			if(v[i] < v[j]){
				int tmp = v[i];
				v[i] = v[j];
				v[j] = tmp;

				int tmpn = ary[i];
				ary[i] = ary[j];
				ary[j] = tmpn;
			}
		}
	}
	
	cout << ary[n-1] << " " << v[n-1] << endl;

	return 0;
}

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

int main(){
  int n,a[20],v[100],i,num,top;
  cin >> n;
  for(i=0;i<n;i++){
    scanf("%d %d",&a[i],&v[i]);
  }
  top=v[0];
  for(i =  1;i<n;i++){
    if(top<v[i]){
      top=v[i];
      num=a[i];
    }
  }
  
  cout << num<<" "<<top<<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<<" "<<v<<endl;
    return 0;
}

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

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
typedef pair<int,int> P;

int main(){
    int n;cin>>n;
    P arr[20];
    rep(i,n){
        int a,v;cin>>a>>v;
        arr[i]=make_pair(a,v);
    }
    partial_sort(arr,arr+1,arr+n,
                 [](const P& a, const P& b){
                     if(a.second!=b.second) return a.second>b.second;
                     return a.first<b.first;
                 });
    cout<<arr[0].first<<" "<<arr[0].second<<endl;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){

    int n;
    cin>>n;
    int a[30]={0};
    for(int i=1;i<=n;i++){
        int x,y;
        cin>>x>>y;
        a[x] = y;
    }
    int m=0,mm=-1;
    for(int i=1;i<=n;i++){
        if(m < a[i]){
            mm = i;
            m = a[i];
        }
        else if(m == a[i] && mm>a[i]){

            mm = i;
            m = a[i];
        }


    }
    cout<<mm<<" "<<m<<endl;


    return 0;
}