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"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int N=in();
	vector<pair<int,int>> P(N);
	REP(i,N){
		P[i].first=in();
		P[i].second=in();
	}
	sort(ALL(P),[](pair<int,int>& l,pair<int,int>& r){return l.second==r.second?l.first<r.first:l.second>r.second;});
	out(P[0].first,P[0].second);
	return 0;
}

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

int main() {
    int n; cin >> n;
    vector<pair<int, int> > vec;
    while(n--) {
        int a, v; cin >> a >> v;
        vec.push_back(make_pair(v, a));
    }
    auto p = *max_element(begin(vec), end(vec));
    cout << p.second << ' ' << p.first << endl;
}

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

int main(){
	int n,p,w;
	cin >> n;
	int max = 0;
	int maxp = 100;
	for(int i=0;i<n;i++){
		cin >> p;
		cin >> w;
		if(max < w){
			maxp = p;
			max = w;
		}else if(max == w){
			if(maxp > p){
			maxp = p;
			}
		}
	}
		cout << maxp << " " << max << endl;
		
		return 0;
}

C++: #include <cstdio>
#include <algorithm>
#include <map>
using namespace std;
int main(void){
  int n;
  scanf("%d",&n);
  pair<int,int> best = make_pair(0,-100);
  for(int i = 0; i < n; i++){
    pair<int,int> p;
    scanf("%d %d",&p.second,&p.first);
    p.second *= -1;
    if(p > best) best = p;
  }
  printf("%d %d\n",-best.second,best.first);
}

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

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 <cstdio>
#include <queue>


typedef std::pair<int, int> P;
int n;

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

    std::priority_queue<P> que;
    for(int i = 0; i < n; i++){
        int a, b;
        scanf("%d %d", &a, &b);
        que.push(P(b, a));
    }

    P p = que.top();
    printf("%d %d", p.second, p.first);

    return 0;
}

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

int main(){
  int n;
  cin >> n;
  map<int, int> point;
  vector<int> tmp(n);
  for(int i = 0; i < n; i++){
    int a, v;
    cin >> a >> v;
    point[a] = v;
    tmp[i] = v;
  }
  sort(tmp.begin(), tmp.end(), greater<int>());
  for(int i = 1; i <= n; i++){
    if(point[i] == tmp[0]){
      cout << i << " " << point[i] << 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>
#include <climits>

int main()
{
	int n;
	int max, argmax;
	int a, v;
	
	std::cin >> n;
	std::cin >> a >> v;
	argmax = a; max = v;
	for (int i=1; i<n; i++) {
		std::cin >> a >> v;
		if (v > max) {
			max = v;
			argmax = a;
		} else if ( v == max && a < argmax ) {
			argmax = a;
		}
	}
	
	std::cout << argmax << " " << max << std::endl;
	
	return 0;
}

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

int main() {
    int n; cin >> n;

    int most_fish = -1, most_people = 0;
    for(int i = 0; i < n; i++) {
        int a, v;
        cin >> a >> v;
        if (most_fish < v) {
            most_fish = v;
            most_people = a;
        } else if (most_fish == v && most_people > a) {
            most_people = a;
        }
    }
    cout << most_people  << " " << most_fish << endl;
}

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

typedef pair<int, int> P;

using namespace std;

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<stdio.h>
int main()
{
	int n;
	int a[20],v[20],max=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d %d",&a[i],&v[i]);
		if(v[i]>max){
			max=v[i];
		}
	}
	for(int i=0;i<n;i++){
		if(max==v[i]){
			printf("%d %d\n",a[i],v[i]);
			break;
		}
	}
	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) idx = index-1, mx = w;
    }

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

    return 0;
}

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

using namespace std;

int main(){
    int n, a, b;
    cin >> n;
    int ra = 1 << 29;
    int rb = -100;
    for(int i = 0;i < n;i++){
	cin >> a >> b;
	if(rb < b || rb == b && ra > a){
	    ra = a;
	    rb = b;
	}
    }
    cout << ra << " " << rb << endl;
    return 0;
}

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

int main()
{
    int n;
    int p[21] = {};

    cin >> n;

    int max = -1, t;
    for( int i = 0; i < n; i++ )
    {
        cin >> t >> p[t];
        if( max < p[t] )
            max = p[t];
    }
    
    int min = 1000;
    for( int i = 1; i <= 20; i++ )
    {
        if( p[i] == max && i < min )
            min = i;
    }

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

    return 0;
}

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

int main(void){

  int n;
  int a[20];
  int v[100];
  int max = 0;
  int num;

  cin >> n;

  for( int i = 0 ; i < n ; i++ ){

    cin >> a[i] >> v[i];

    if( max < v[i] ){
      
      max = v[i];
      num = a[i];
    }

  }

  cout << num << " " << max << endl;

  return 0;

}