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 <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,ac[30]={},win=0,ss,qq,i;
	cin>>ss;
	for(int e=0;e<ss;e++){
		cin>>a;
		cin>>ac[e];
		if(ac[e]>=win){
			if(ac[e]==win){
				if(qq>a) qq=a;
			}
			else{
				win=ac[e];
				qq=a;
			}
		}
	}
	cout<<qq<<" "<<win<<endl;
}

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));
    }
    stable_sort(v.begin(),v.end());
    cout << v[0].second << ' ' << (-1)*v[0].first << endl;

    return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back

using namespace std;

typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;

vi t(21);

int main(void){
    int n; cin >> n;
    fill(ALL(t), -1);

    while(n --){
        int a, v; cin >> a >> v;
        t[a] = v;
    }
    vi::iterator res = max_element(ALL(t));

    cout << res - t.begin() << " " << *res << endl;

    return 0;
}

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

int main()
{
  int n;
  int w1, max = 0;

  cin >> n;
  for (int i = 0; i < n; i++){
    int a, v;
    cin >> a >> v;
    if (max < v){
      max = v;
      w1 = a;
    }
    else if (max == v){
      if (w1 > a){
        w1 = a;
      }
    }
  }
  cout << w1 << ' ' << max << endl;
  return (0);
}

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

int main(){
	int person[20], fish[20];
	int n;
	int array[20];
	int fishPerson[20];
	int cont = 0;
	cin >> n;
	for(int i=0; i < n; i++){
		cin >> person[i] >> fish[i];
		array[i] = fish[i];
	}
	sort(array, array+n, greater<int>());

	for(int i=0; i < n; i++){
		if(array[0] == fish[i]){
			fishPerson[cont] = person[i];
			cont++;
		}
	}
	sort(fishPerson, fishPerson+cont);

	for(int i=0; i < 20; i++){
		if(fishPerson[0] == person[i]){
			cout << person[i] << " " << fish[i] << endl;
		}
	}




}

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

double dp[2001][2001];

int main(){
	int N,A,B,ans1,ans2=0;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>A>>B;
		if(B>ans2){
			ans1 = A; ans2 = B;
		}
	}
	printf("%d %d\n",ans1,ans2);
	return 0;
}

C++: #include <stdio.h>

int main(void)
{
	int i;
	int n;
	int a;
	int v;
	int ma;
	int mv;
	
	scanf("%d", &n);
	
	mv = 0;
	for (i = 0; i < n; i++){
		scanf("%d %d", &a, &v);
		
		if (v > mv || v >= mv && a < ma){
			mv = v;
			ma = a;
		}
	}
	printf("%d %d\n", ma, mv);
	
	return (0);
}

C++: #include <iostream>
#include <stdio.h>

using namespace std;

int main() {
   int n,a,v,ma=999,mv=-1;
   cin >> n;
   for (n;n>0;n--) {
   cin >> a >> v;
   if (mv<=v) { if (mv==v) ma=min(ma,a); else ma=a; mv=v; }
   }
   cout << ma << ' ' << mv << endl;
   return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,s[20],d[20],f,g,h;
	g=0;
	scanf("%d",&a);
	for(f=1;f<=a;f++){
		scanf("%d %d",&s[f],&d[f]);
	}
	for(f=1;f<=a;f++){
		if(g<d[f]){
		g=d[f];
		h=s[f];
		}
	}
	printf("%d %d",h,g);
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
  int a,b,n;
  int x[2]={21,0};
  cin>>n;
  while(n--){
    cin>>a>>b;
    if(x[1]<=b){
      x[0]=(x[1]==b)?(x[0]>a)?a:x[0]:a;x[1]=b;
    }
  }
  cout<<x[0]<<' '<<x[1]<<endl;
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

int n;
int a, v;
int ra, rv;

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

  rep(i, n){
    scanf(" %d %d", &a, &v);
    if(v == rv && a < ra) ra = a;
    if(maxup(rv, v)) ra = a;
  }

  printf("%d %d\n", ra, rv);

  return 0;
}

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

struct person {
	int a;
	int v;
};
int main() {
	struct person man[25],max;
	max.a=max.v=0;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>man[n].a>>man[n].v;
		if(max.v<man[n].v)max=man[n];
	}
	cout<<max.a<<" "<<max.v<<endl;
	
	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 = min( a, winner );
      maxv = v;
    }
  }
  cout << winner << " " << maxv << endl;

  return EXIT_SUCCESS;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int n,b[100]={0},a,v,best=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>v;
		b[a]+=v;
		if(best<b[a])
			best=b[a];
	}
	int i=0;
	while(true){
		if(best==b[i]){
			cout<<i<<" "<<b[i]<<endl;
			break;
		}
		i++;
	}
    return 0;
}