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 <algorithm>
using namespace std;

int main(void){
  int n,num,w;
  pair<int,int>;  

  cin >> n;
  for(int i = 0 ; i < n ; i++){
    cin >> num >> w;
    p[num-1].first = num;
    p[num-1].second = w;
  }

  sort(p,p+n);
  cout << p[0].first << ' ' << p[0].second << endl;

  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){

	int n;
	int ary[101] , v[101];

	cin >> n;

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

	for(int i = 0; i < n; i++){
		for(int j = 0; j < n-1; j++){
			if(v[i] < v[j]){
				int tmp = v[j];
				v[j] = v[i];
				v[i] = tmp;

				int tmpn = ary[j];
				ary[j] = ary[i];
				ary[i] = tmpn;
			}
		}
	}
	
	cout << ary[n-1] << " " << v[n-1] << endl;

	return 0;
}

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

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

int main() {
  int n, a, v, ma = 1, mv = 0;
  cin >> n;
  for(int i = 0; i < n; i++) {
    cin >> a >> v;
    if(v > mv) {
      ma = a;
      mv = v;
    }
  }
  cout << ma << ' ' << mv << endl;
}

C++: #include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;

int main(){
  int n;
  int num=1,max=0;
  int tmpnum,tmp;
    cin>>n;
    while(n){
        cin>>tmpnum>>tmp;
        if(max<tmp){
            num=tmpnum;
            max=tmp;
        }
        --n;
    }
    cout<<num<<" "<<max<<endl;
  return 0;
}

C++: #include<iostream>
#include<map>
#include<algorithm>
using namespace std;
typedef pair < int , int > Pi;
int main(){
  int n;
  Pi a[20];
  cin >> n;
  for(int i = 0 ; i < n ; i++ ){
    cin >> a[i].second >> a[i].first;
    a[i].second = -a[i].second;
  }
  sort( a, a + n);
  Pi *itr = max_element(a, a + n);
  cout << -(*itr).second << " " << (*itr).first << 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++){
    scanf(" %d %d",&num,&rec);
    if(rec>max){
      max=rec;
      maxi=num;
    }
  }
  cout << maxi << " " << max << endl;  
  return(0);
}

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

int main() {
	int n;
	int x[20];
	int y[20] = {};
	cin >> n;

	for (int i = 0;i < n;i++) {
		int a, v;
		cin >> a >> v;
		x[a - 1] = v;
		y[a - 1] = x[a - 1];
	}
	sort(y, y + 20);
	for (int i = 0;i < 20;i++) {
		if (y[19] == x[i]) {
			cout << (i + 1) << ' ' << x[i] << endl;
		}
	}
	return 0;
}

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

int main(){
	int n,max=-1,num=-1,a[20],v[20];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i]>>v[i];
		if(max<v[i] && max!=v[i]){
			num=i;
			max=v[i];
		}else if(max==v[i] && num>a[i]){
			num=a[i];	
		}
	}
	cout<<num+1<<" "<<max<<endl;

		return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;

vector<pii> v;

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

    for (int i = 0; i < n; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        v.push_back(pii(-b, a));
    }

    sort(v.begin(), v.end());
    
    cout << v[0].second << " " << -v[0].first << endl;

    return 0;
}

C++: #include <cstdio>

using namespace std;

int main()
{
 int n;
 int a[20], v[20];
 scanf("%d", &n);

 for (int i = 0; i < n; i++) scanf("%d %d", a + i, v + i);

 int ai = 9999, vi = -1;

 for (int i = 0; i < n; i++){
  if (v[i] > vi){
    vi = v[i];
    ai = a[i];
  }
  else if (v[i] == v[i]){
    if (ai > a[i]) ai = a[i];
  }
 }
 return (!printf("%d %d\n", ai, vi));
}

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

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

C++: #include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-9;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
    int n;cin>>n;
    int ma=0;int aa;
    for(int i=0;i<n;i++){
        int a,v;cin>>a>>v;
        if(v>ma){
            aa=a;
            ma=v;
        }
    }
    cout<<aa<<" "<<ma<<endl;
}

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

using namespace std;

int main() {
    using player = pair<int, int>;
    
    int n;
    priority_queue<player> score;
    
    cin >> n;

    for(int i = 0; i < n; i++) {
        int sc, num;
        cin >> num >> sc;
        score.push(make_pair(sc, -num));
    }

    cout << score.top().second * -1 << ' ' << score.top().first << endl;

    return 0;
}

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

int main(){
  int n,a[100],v[100],i,num,top;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> 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 <iostream>
#include <cstdio>

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

using namespace std;

int main(){
    int n;
    cin >> n;
    int s[21] = {0};

    rep(i,n){
        int a,v;
        cin >> a >> v;
        s[a] += v;
    }
    int ans=0;
    int sum=0;
    reep(i,1,n+1){
        if(sum<s[i]){
            ans = i;
            sum = s[i];
        }
    }

    printf("%d %d\n",ans, sum);
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<double,int> p;

int main(){
    vector<p> v;
    int n,num,data,m;
    
    cin >> n;
    m = n;
    while(n--){
        cin >> num >> data;
        v.push_back(p(data,num));
    }
    sort(v.begin(),v.end());
    cout << v[m-1].second << ' ' << v[m-1].first << endl;
    
    return 0;
}

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();i>=0;i--){
    if(p[i].FR==maxi){
      par=min(par,p[i].SC);
    }
  }
  cout<<par<<' '<<maxi<<endl;
  return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<utility>

using namespace std;

int main(void){

	int n;
	pair<int,int> inp;
	pair<int,int> max;

	cin>>n;

	cin>>max.first>>max.second;
	for(int i=1;i<n;i++){
		cin>>inp.first>>inp.second;
		if(inp.second>max.second||(inp.second==max.second&&inp.first<max.first)) max=inp;
	}

	cout<<max.first<<" "<<max.second<<endl;

	return 0;
}