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

int main(){

	int n;
	int fish[20];
	int ans1 = 0;
	int ans2;
	int num;

	cin >> n;

	for (int i = 0; i < n; i++){
		cin >> num;
		cin >> fish[num - 1];
	}

	for (int i = 0; i < n; i++){
		if (fish[i] > ans1){
			ans1 = fish[i];
			ans2 = i + 1;
		}
	}

	cout << ans2 << " " << ans1 << endl;

	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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

int main()
{
    int n;
    cin >> n;
    
    pii ans(-1, -1);
    rep(i, n){
        pii t;
        cin >> t.second >> t.first;
        t.second *= -1;
        ans = max(ans, t);
    }
    
    cout << -ans.second << ' ' << ans.first << endl;
}

C++: #include<stdio.h>
int main(void)
{
	int n,a,b,i,m,z;
	m=-1;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&a,&b);
		if(m<b){
			m=b;	
			z=a;
		}
		else if(m==b){
			if(a<z){
				z=a;
			}
		}
	}
	printf("%d %d\n",z,m);
	return 0;
}

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>b;
    else 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;
    }
    sort(v.begin(),v.end(),comb);
    cout<<v[n-1].se<<" "<<v[n-1].fi<<endl;

    return 0;
}

C++: #include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
#define sort(ss) sort(ss.begin(), ss.end())
#define rsort(ss) sort(ss.rbegin(), ss.rend())
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return acos(-1.0);
}
typedef set<int> set_i;
typedef set<string> set_s;
int INF=1000000;
int main(){
	int a[30]={},win=0,ss,qq,i;
	cin>>ss;
	for(int e=0;e<ss;e++){
		cin>>i;
		cin>>a[i];
		if(a[i]>win){
			win=a[i];
			qq=i;
		}
	}
	cout<<qq<<" "<<a[qq]<<endl;
}

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

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

		return 0;
}

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=0;i<n;i++){
        int x,y;
        cin>>x>>y;
        a[x] = y;
    }
    int m=0,mm=-1;
    for(int i=0;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; cin >> n;
    int w, idx = 0, mx = 0;
    for(int i=0, index=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>
using namespace std;
int main(){
	int n[20],num,x,z,max=0;
	cin>>num;
	for(int i=0;i<num;i++){
		cin>>x>>n[x];
		if(max<n[x]){
			max=n[x];
			z=x;
		}
	}
	cout<<z<<" "<<max<<endl;
	return 0;
}

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

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

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

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

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
#include <sstream>
#include <queue>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

int main() {
    vector<pair<int,int>> w;
    int n;
    cin >> n;
    REP(i,n) {
        int a, v;
        cin >> a >> v;
        w.push_back(make_pair(100-v, a));
    }
    sort(w.begin(),w.end());
    cout << w[0].second << " " << 100-w[0].first << endl;
    return 0;
}

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

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

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

	return 0;
}

C++: // #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>	// istringstream
using namespace std;

int main(){
	int n, max = 0, ans = 0;
	int bangou = 0, num = 0;
	map<int, int> list;

	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> bangou >> num;
		if (max < num){
			max = num;
			ans = bangou;
		}
		else if (max == num){
			if (bangou < ans)
				ans = bangou;
		}
	}
	cout << ans << " " << max << endl;

	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
  int n;
  for(;cin>>n;)
    {
      int a,v;
      cin>>a>>v;
      for(int i=1;i<n;i++)
	{
	  int ta,tv;
	  cin>>ta>>tv;
	  if(tv>v || (tv==v && a>ta))
	    {
	      v=tv;
	      a=ta;
	    }
	}
      cout<<a<<" "<<v<<endl;
    }
}