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<stdio.h>
int main(void)
{
	int n,a,b,c,i,max,min;
	max=-1;
	min=101;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&a,&b);
		if(max==b&&min>a){
			min=a;
		}
		if(max<b){
			max=b;
			min=a;
		}
	}
	printf("%d %d\n",min,max);
	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){
            kouho = a;
        }
        if(max < b){
            max = b;
            kouho = a;
        }
    }
    cout << kouho << " " << max << endl;
}

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

int main(){
	int n;
	int person[22], fish[22];
	int array[22];
	int fisherMan[22];
	int fisher = 0;

	cin >> n;
	for(int i=0; i < n; i++){
		cin >> person[i] >> fish[i];
		array[i] = fish[i];
	}
	sort(array, array+n, greater<int>());

	for(int i=0; i < n; i++){
		if(fish[i] == array[0]){
			fisherMan[fisher] = person[i];
			fisher++;
		}
	}

	sort(fisherMan, fisherMan+fisher);

	cout << fisherMan[0] << " "  << array[0] << endl;
}

C++: #include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
using namespace std;
int main(){
int n;
cin>>n;
vector<int>in;
vector<int>no;
rep(i,n){
int a,b;
cin>>a>>b;
pb(in,b);
pb(no,a);
}
rep(i,100*n){
rep(j,n-1){
if(in[j]<in[j+1]){swap(in[j],in[j+1]);swap(no[j],no[j+1]);}
if(in[j]==in[j+1]&&no[j]<no[j+1])swap(no[j],no[j+1]);
}
}
cout<<no[0]<<" "<<in[0]<<endl;
}

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].fi){
                    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 <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int main(){
	int n,a[20],b[20],k;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a[i] >> b[i];
	}
	for(int j=1;j<n;j++){
		for(int i=0;i<n-j;i++){
			if(b[i]<b[i+1]){
				k=b[i];b[i]=b[i+1];b[i+1]=k;
				k=a[i];a[i]=a[i+1];a[i+1]=k;
			}
		}
	}
	cout << a[0] <<" "<< b[0] <<"\n";
return 0;
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  cin >> n;
  vpii v(n);
  rep(i, n) cin >> v[i].se >> v[i].fi;
  stable_sort(rall(v));
  cout << v[0].se << ' ' << v[0].fi << endl;
}

C++: #include <iostream>

using namespace std;

int info[22];

int main()
{
    int n, a, v;
    int max_idx = 0;

    cin >> n;
    
    info[max_idx] = -10;
    for (int i = 0; i < n; i++) {
        cin >> a >> v;
        info[a] = v;
    }
    
    for (int i = 1; i <= n; i++)
        if (info[max_idx] < info[i])
            max_idx = i;
    cout << max_idx << " " << info[max_idx] << endl;
    
    return 0;
}

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

using namespace std;
/** Problem0095 : Surf Fishing Contest **/
int main()
{
	map<int, vector<int> > list;
	int n, a, v, maxV=0;
	
	cin >> n;
	for (int i=0; i<n; i++) {
		cin >> a >> v;
		list[v].push_back(a);
		maxV = max(v, maxV);
	}
	
	vector<int> vec = list[maxV];
	sort(vec.begin(), vec.end());
	cout << vec[0] << " " << maxV << endl;
	return 0;
}

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

int a[20], idx, mx;

int main()
{
    int n; cin >> n;
    for(int i=0, index=0;i < n; ++i) {
        cin >> index >> a[index-1];
        if (mx < a[index-1]) mx = a[index-1], idx = index;
    }

    cout << idx << " " << mx << endl;

    return 0;
}

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

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

int main(){
	int a, v, n, maxv, mina;
	cin>>n;
	cin>>a>>v;
	maxv=v;
	mina=a;
	for(int i=1;i<n;i++){
		cin>>a>>v;
		if(maxv<v){
			maxv=v;
			mina=a;
		}else if(maxv==v){
			if(mina>a){
				mina=a;
			}
		}
	}
	cout<<mina<<" "<<maxv<<endl;
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
	int al=99999,vl=0,n;
	cin>>n;
	int a,v;
	for(int i=0;i<n;i++){
		cin>>a>>v;
		if(v>vl){
			vl=v;
			al=a;
		}else if(v==vl){
			if(al>a)al=a;
		}
	}
	cout<<al<<" "<<vl<<endl;
}