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 <string>
#include <map>
#include <vector>
#include <utility>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

bool comb(pair<int,int> a,pair<int,int> b){
    if(a.first==b.first){
        return a.second>b.second;
    }else return a>b;
}

int main(){
    int n;cin>>n;
    vector<pair<int,int>> v(n);
    
    rep(i,0,n){
        cin>>v[i].se>>v[i].fi;
    }
    rep(i,0,n-1){
        rep(j,i+1,n){
            if(v[i].fi>v[j].fi){
                pair<int,int> temp;
                temp=v[i];
                v[i]=v[j];
                v[j]=temp;
            }else if(v[i].fi==v[j].fi){
                if(v[i].se>v[i].se){
                    pair<int,int> temp;
                    temp=v[i];
                    v[i]=v[j];
                    v[j]=temp;
                }
            }
        }
    }
    cout<<v[n-1].se<<" "<<v[n-1].fi<<endl;

    return 0;
}

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

int main(){
	int n,x,y=-1;
	cin>>n;
	while(n--){
		int a,b;
		cin>>a>>b;
		if(y<b || b==y&&a<x)x=a,y=b;
	}
	cout<<x<<' '<<y<<endl;
	return 0;
}

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

int main(){
    int a[30]={0},p,q,m=0,b=1;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>p>>q;
        a[p]+=q;
    }
    for(int i=0;i<30;i++){
        if(m<a[i]){
            m=a[i];
            b=i;
        }
    }
    cout<<b<<" "<<m<<endl;
}

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 || rec >= max && num <= maxi){
      max=rec;
      maxi=num;
    } 
  }
  cout << maxi << " " << max << endl;  
  return(0);
}

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]&&a<m)m=a;
  }
  cout << m << " " << d[m] << endl;
}

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

int main()
{
    int n;
    int g[20] = {}, p[20] = {};

    cin >> n;

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

    int max = -1;    
    for( int i = 0; i < n; i++ )
    {
        if( max < p[i] )
            max = p[i];
    }

    int min = 1000;
    for( int i = 0; i < n; i++ )
    {
        if( p[i] == max )
        {
            if( min > g[i] )
                min = g[i];
        }
    }

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

    return 0;
}

C++: #include <stdio.h>

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

C++: #define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <vector>
#include <algorithm>

#define int64 long long int
using namespace std;

typedef pair<int, int> P;

class Hoge {
public:
	int a, v;
	Hoge(int a, int v){
		Hoge::a = a, Hoge::v = v;
	}
	Hoge(){}
};

class LS
{
public:
	bool operator() (Hoge h1, Hoge h2){
		if(h1.v == h2.v) return (h1.a > h2.a) ? true : false;
		else return (h1.v < h2.v) ? true : false;
	}
};

int main()
{
	int n, a, v;
	Hoge *hoge;

	cin >> n;

	hoge = new Hoge[n];

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

	priority_queue<Hoge, vector<Hoge>, LS> qu;

	for(int i=0; i<n; i++) qu.push(hoge[i]);

	cout << (qu.top()).a << ' ' << (qu.top()).v << endl;

	delete [] hoge;

	return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
  int A,B=-1;

  int n;
  cin >> n;
  while(n--){
    int a,b;
    cin >> a >> b;

    if(B < b){
      A = a;
      B = b;
    }
  }
  cout << A << " " << B << endl;

  return 0;
}

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

int main()
{
	int n;
	while( cin >> n ){
		int ansA, ansV;
		ansA = 100, ansV = 0;
		for( int i = 0; i < n; ++i ){
			int a, v;
			cin >> a >> v;
			if( ansV < v ){
				ansA = a;
				ansV = v;
			}else if( ansA > a ){
				ansA = a;
			}
		}
		cout << ansA << " " << ansV << endl;
	}

	return 0;
}

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

int main() 
{
	map<int, int>s;
	int a;
	cin >> a;
	for (int b = 0; b < a; b++) {
		int c, d;
		cin >> c >> d;
		if (s[d] > c)s[d] = c;
	}
	auto e = s.end();
	e--;
	cout << e->second << " " << e->first << endl;
}

C++: #include<stdio.h>
int main()
{
	int n;
	int a,v[20],r[20],max=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d %d",&a,&v[i]);
		r[a-1]=v[i];
	}
	for(int i=0;i<n;i++){
		if(r[i]>max){
			max=r[i];
		}
	}
	for(int i=0;i<n;i++){
		if(max==r[i]){
			printf("%d %d\n",i+1,r[i]);
			break;
		}
	}
	return 0;
}

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

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

int main(void) {
	int n, max_player,a,b,max=-1;
	cin >> n;
	while (n) {
		cin >> a >> b;
		if (b > max) {
			max_player = a;
			max = b;
		}
		else if (b == max) {
			if (max_player > a)max_player = a;
		}
		n--;
	}
	cout << max_player << " " << max << endl;

}

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 ){
			max=b;
			num=a;
		}
		else if( max == b && num > a ) num=a;
	}
	
	cout << num << " " << max << endl ;
	
return 0;
}

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

int main(){
  int n,a[50],v[50];

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

  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      if(v[i] < v[j]){
	swap(a[i],a[j]); swap(v[i],v[j]);
      }else if(v[i] == v[j] && a[i] > a[j]){
	swap(a[i],a[j]); swap(v[i],v[j]);
      }
    }
  }	

  cout << a[0] << " " << v[0] << endl;
}

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

int main(){
	int n,max=0,maxmax;
	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];
			maxmax=i;
		}
	}
	cout<<maxmax+1<<" "<<max<<endl;

		return 0;
}