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 <map>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main ()
{
    int n;
    cin >> n;
    vector <pair<int,int> > V;
    for (int i = 0; i <= n; i++) {
        V.push_back(pair<int,int>(0,i));
    }
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        V[a].first += b;
    }
    sort(V.begin(), V.end());
    int i = 1;
    while (V[i].first != V[n].first) i++;
    cout << V[i].second << " " << V[i].first << endl;

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;

int main(){
  int n;
  cin>>n;
  P a[101];
  for(int i=0;i<n;i++) cin>>a[i].second>>a[i].first,a[i].second*=-1;
  sort(a,a+n,greater<P>());
  cout << -a[0].second<<" "<<a[0].first<<endl;
  
  return 0;
}

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

int main()
{
  int a[21], b[21];
  int n;
  int max = 0;
  int mx;
  cin >> n;
  for (int i = 1; i <= n; i++){
    cin >> a[i] >> b[i];
    if (b[i] >= max){
      max = b[i];
    }
  }
  int i = 0;
  while (1){
    if (b[i] == max){
      cout << mx << " " << max << endl;
      break;
    }
  }


  return 0;

}

C++: #include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<numeric>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;
bool pr(const pair<int,int>& p,const pair<int,int>& q){
  if(p.second==q.second)
    return p.first<q.first;
  else
    return p.second>q.second;
}
int main(){
  int i;
  int n;
  cin>>n;
  pair<int,int> a[20];
  for(i=0;i<n;++i)
    cin>>a[i].first>>a[i].second;
  sort(a,a+n,pr);
  cout<<a[0].first<<' '<<a[0].second<<endl;
  return 0;
}

C++: #include<iostream>
int a,v,A,V;main(){for(std::cin>>A;std::cin>>a>>v;)(V<v||V==v&A>a)&&(V=v)&(A=a);std::cout<<A<<" "<<V<<"\n";}

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

int main() {
  int n;
  cin >> n;
  vector<pair<int ,int> > a(n);

  for(int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }

  int max = -1;
  int max_num = 0;
  for(int i = 0; i < n; i++) {
    if(max < a[i].second) {
      max = a[i].second;
      max_num = a[i].first;
    }
  }

  cout << max_num << " " << max << endl;

  return 0;
}

C++: #include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  int N; cin >>N;
  map<int, int> m;
  REP(i, N){
    int a, v; cin >>a >>v;
    m[a] = v;
  }
  int ans = 0;
  for(auto i : m) if(i.second > m[ans]) ans = i.first;
  cout <<ans <<" " <<m[ans] <<endl;
  return 0;
}

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

using namespace std;

struct point{
  double x, y;
};

bool cmp_x(const point& p, const point& q){
  if(p.x != q.x)return p.x>q.x;
  return p.y < q.y;
}

int main(void){
  int n;
  point a;
  vector<point>v;

  cin >> n;
  while(n--){
    cin >> a.y >> a.x;
    v.push_back(a);
  }

  sort(v.begin(),v.end(),cmp_x);

  cout << v[0].y << " "<< v[0].x <<endl;

  return 0;
}

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

struct Data{
	int A,B;
	bool operator<(const Data &a)const{
		if(B!=a.B) return B>a.B;
		else return A<a.A;
	}
};

int main(){
	int N;
	Data H[20];
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>H[i].A>>H[i].B;
	}
	sort(H,H+N);
	printf("%d %d\n",H[0].A,H[0].B);
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int n;
	int a[21],v[101];
	int i;
	int max=0,m;

	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&a[i],&v[i]);
		if(max<v[i]){
			max=v[i];
			m=a[i];
		}
	}
	printf("%d %d\n",m,max);
	return 0;
}

C++: #include <iostream>
#include <cstdlib>
#include <climits>

using namespace std;

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

  int maxv = INT_MIN;
  int winner = INT_MAX;
  for( int i = 0; i < n; i++ ) {
    int a, v;
    cin >> a >> v;
    if( maxv < v ) {
      winner = a;
      maxv = v;
    } else if( maxv == v ) {
      winner = min( a, winner );
    }
  }
  cout << winner << " " << maxv << endl;

  return EXIT_SUCCESS;
}

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

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

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

C++: //24
#include<iostream>

using namespace std;

int main(){
  int n;
  cin>>n;
  int x,m=-1;
  while(n--){
    int a,v;
    cin>>a>>v;
    if(v>m||v==m&&a<x){
      m=v;
      x=a;
    }
  }
  cout<<x<<' '<<m<<endl;
  return 0;
}

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

int main() {
	int n;
	int s[105] = {};
	int sa[105] = {};
	cin >> n;
	for (int i = 0;i < n;i++) {
		int a, v;
		cin >> a >> v;
		s[a - 1] += v;
		sa[a - 1] = s[a - 1];
	}
	sort(sa, sa + 105);

	for (int i = 0;i < 25;i++) {
		if (sa[104] == s[i]) {
			cout << i + 1 << endl;
			break;
		}
	}
	return 0;

}

C++: #include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#define rep(i,a,n) for(int i=a;i<n;i++)
using namespace std;

int main(void){
	int n,m[1000],a[1000],max=0,num;
	a[0]=-1;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> m[i];
		cin >> a[m[i]];
	}
	for(int i=0;i<n;i++){
		if(max<a[m[i]]){
			max = a[m[i]];
			num = m[i];
		}
		if( (max==a[m[i]])&&(num<m[i]) ){
			max = a[m[i]];
			num = m[i];
		}
	}
	cout << num << " " << max << "\n";
	return 0;
}

C++: #include<iostream>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int n;
	cin>>n;
	int num;
	int fish;
	int ansnum;
	int ansfish=-1;
	rep(i,n){
		cin>>num>>fish;
		if(ansfish<fish){
			ansfish=fish;
			ansnum=num;
		}
	}
	cout<<ansnum<<" "<<ansfish<<endl;
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector< pair<int, int> > ls(n);
    for(int i = 0; i < n; i++){
        cin >> ls[i].second >> ls[i].first;
    }
    sort(ls.begin(), ls.end());
    cout << ls[n-1].second << ' ' << ls[n-1].first << endl;
    return 0;
}