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<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

int n;
int a, v;
int ra, rv = -1;

int main()
{
  scanf(" %d", &n);

  rep(i, n){
    scanf(" %d %d", &a, &v);
    if(v == rv && a < ra) ra = a;
    if(v > rv) rv = v,  ra = a;
  }

  printf("%d %d\n", ra, rv);

  return 0;
}

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

#define n_fish first
#define number second

using namespace std;

typedef pair<int, int> PAIR;

struct CompEntrants{
  bool operator()(const PAIR &entrant1, const PAIR &entrant2) const
  {
    if(entrant1.n_fish == entrant2.n_fish)
      return entrant1.number < entrant2.number;
    return entrant1.n_fish > entrant2.n_fish;
  }
};

int main()
{
  int n_entrants;
  vector<PAIR> entrants;
  PAIR entrant;

  cin >> n_entrants;
  for(int i = 0; i < n_entrants; ++i){
    cin >> entrant.number >> entrant.n_fish;
    entrants.push_back(entrant);
  }
  sort(entrants.begin(), entrants.end(), CompEntrants());

  cout << entrants.front().number << " " << entrants.front().n_fish << endl;

  return 0;
}

C++: #include <iostream>
#include <complex>
#include <array>

using namespace std;

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

int main(){
    int n;cin>>n;
    int id,ans=-1;
    rep(i,n){
        int a,v;cin>>a>>v;
        if(v>ans){
            ans=v;
            id=a;
        }
    }
    cout<<id<<" "<<ans<<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];
        }


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


    return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int n, a, v, maxa, maxv;

	cin >> n >> maxa >> maxv;

	for (int i=0; i<n-1; i++)
	{
		cin >> a >> v;

		if(v == maxv){
			if(a < maxa){
				maxa = a;
				maxv = v;
			}
		}
		else if(v > maxv){
				maxa = a;
				maxv = v;
		}
	}

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

	return 0;
}

C++: #include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

////////////////*My library*////////////////////////
#define rep_to(a,i,n) for(i=a;i<n;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define rep_r(i,n) for(i=n-1;i>=0;i--)
#define debug_i(x) printf("x:%d\n",x)
#define debug_s(str) printf("str:%s\n",str)
#define debug_c(c) printf("c:%c\n",c)
#define s_i1(x) scanf("%d",&x)
#define s_i2(x,y) scanf("%d %d",&x,&y)
#define s_i3(x,y,z) scanf("%d %d %d",&x,&y,&z)
////////////////////////////////////////////////////
////////////////////////
/*prime()*/
/*primecount()*/
/*sort()*/
///////////////////////

int main()
{
	int i,j,k;
	int n,q;
	int x,y,sd_num=0;
	double max=0,num=0,sd_max=0;
	int a[100000]={},v[100000]={};

	s_i1(n);
	rep(i,n)
	{
		scanf("%d %d",&x,&y);
		v[x]+=y;
		num=(max<v[x])? x : num;
		max=fmax(v[x],max);

		if(max==v[x])num=fmin(num,x);
	}
	printf("%d %d\n",(int)num,(int)max);
	return 0;
}

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

int main()
{
    int n, a, v;
    cin >> n;
    vector<pair<int, int> > vec;
    for (int i = 0; i < n; ++i) {
        cin >> a >> v;
        vec.push_back(make_pair(v, a));
    }
    vector<pair<int, int> >::iterator top =
        max_element(vec.begin(), vec.end());
    cout << top->second << " " << top->first << endl;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
using namespace std;
 
#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999
 
#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
 
typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;
 
typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;
 
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;
 
namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}
 
int main() {
    int n;
    int m = 0;
    cin >> n;

    pii a[20];
    rep(i,0,n) {
        cin >> a[i].second >> a[i].first;
        m = max(m, a[i].first);
    }

    sort(a, a+n);
    int ans = lower_bound(a, a+n, pii(m,0)) - a;
    cout << a[ans].second << " " << a[ans].first << endl;
    return 0;
}

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

C++: #include<stdio.h>
 
int main(){
	int n, a, b, i, max = 0, num = 100;
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		scanf("%d %d", &a, &b);
		if(max <= b){
			max = b;
			if(max < b || num > a){
				num = a;
			}
		}
	}
	printf("%d %d", num, max);
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[2]={-1,-1};
	for(int i=0;i<n;i++){
		int b,c;
		cin>>b>>c;
		if(c==a[1])
			a[0]=min(a[0],c);
		if(c>a[1]){
			a[0]=b;
			a[1]=c;
		}
	}
	cout<<a[0]<<" "<<a[1]<<endl;
}