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,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


signed main(){
  int n;
  cin>>n;
  vector<pair<int,int>> p;
  REP(i,n){
    int a,v;
    cin>>a>>v;
    p.PB(MP(v,a));
  }
  sort(ALL(p));
  int maxi=p.back().FR;
  int par=p.back().SC;
  for(int i=p.size()-1;i>=0;i--){
    if(p[i].FR==maxi){
      par=min(par,p[i].SC);
    }
  }
  cout<<par<<' '<<maxi<<endl;
  return 0;
}

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

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

C++: #include <cstdio>

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

using namespace std;

int main(){
	int n; scanf("%d",&n);
	int a0,v0=-1;
	rep(i,n){
		int a,v; scanf("%d%d",&a,&v);
		if(v0<v || v0==v && a0>a) a0=a, v0=v;
	}
	printf("%d %d\n",a0,v0);

	return 0;
}

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

C++: #include <stdio.h>
#include <cmath>
#include <algorithm>

using namespace std;


int main(){

	int n,tmp_id,max_id,max=-1,tmp;

	scanf("%d",&n);

	for(int i=0; i < n; i++){
		scanf("%d %d",&tmp_id,&tmp);
		if(tmp > max){
			max = tmp;
			max_id = tmp_id;
		}else if(tmp == max){
			if(max_id > tmp_id){
				max_id = tmp_id;
			}
		}
	}

	printf("%d %d\n",max_id,max);

    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,a,v;
  int ansa=1000,ansv=0;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a >> v;
    if(ansv<v){
      ansa = a;
      ansv = v;
    }
    else if(ansv==v&&ansa>a){
      ansa = a;
      ansv = v;
    }
  }
  cout << ansa << ' ' << ansv << endl;
  return 0;
}

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

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

		return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<int,int> p;
 
int main(){
    vector<p> v;
    int n,data,num;
     
    cin >> n;
    for(int i = 0 ; i < n ; i++){
        cin >> num >> data;
        v.push_back(p(data,num));
       }
        sort(v.begin(),v.end());
	cout << v[n-1].second << ' ' << v[n-1].first << endl;
	return 0;
}

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



int main()
{
	int n;
	cin>>n;
	int id,val=-1;
	for(int i=0;i<n;i++)
	{
		int a,v;
		cin>>a>>v;
		if(val<v)
		{
			id=a;
			val=v;
		}
		else if(val==v)
		{
			id=min(id,a);
		}
		
	}
	cout<<id<<" "<<val<<endl;
}

C++: #include<iostream>

using namespace std;

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

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

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

int main(){
  int n,a[100],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++: #include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<pair<int,int> > p(n, pair<int,int>(0,0));
  for (int i = 0; i < n; i++){
    cin >> p[i].second >> p[i].first;
    p[i].second = -p[i].second;
  }
  sort(p.begin(), p.end(), greater<pair<int,int> >());
  cout << (-p[0].second) << ' ' << p[0].first << 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(); que.pop();
    while(!que.empty()){
        P q = que.top(); que.pop();

        if(q.first < p.first) break;

        if(p.second > q.second){
            p = q;
        }
    }
    printf("%d %d\n", p.second, p.first);

    return 0;
}

C++: #include<stdio.h>

int main(){

int x,y,n;
int X=0,Y=0;


scanf("%d",&n);

for(int i=0;i<n;i++)
{
scanf("%d %d",&x,&y);
if(i==0){Y=y;X=x;}
if(Y==y&&x<X){X=x;Y=y;}
else if(Y<y){X=x;Y=y;}

}

printf("%d %d\n",X,Y);
return 0;
}

C++: #include <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

#define INF 1000000000

typedef long double Real;
#define EPS 1e-13
#define EQ(x) (-EPS<x && x<EPS)
typedef complex<Real> P;
Real dot(P a,P b){return real(conj(a)*b);}
Real cross(P a,P b){return imag(conj(a)*b);}

int main(){
  int n;
  cin>>n;
  pii s;
  s.first = -1;
  s.second = -1;
  REP(i,n){
    pii t;
    cin>>t.second>>t.first;
    t.second = 10000000 - t.second;
    s = max(s,t);
  }
  cout<<(10000000-s.second)<<" "<<s.first<<endl;
  return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int a[1000000], b[1000000], maxid, maxn, n;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
		if (maxn < b[i]) {
			maxn = b[i];
			maxid = a[i];
		}
		else if (maxn == b[i]) {
			maxid = min(maxid, a[i]);
		}
	}
	cout << maxid << ' ' << maxn << endl;
}

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){
			max=b;
			c=a;
	/*	}
		if(min>c){
			min=c;
		}*/
		
	}
	printf("%d %d\n",min,max);
	return 0;
}