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<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
int main(){
	int ta[10000]={0},n;
	cin>>n;
	for(int i=0;i<n;i++){
	int a,b;
	cin>>a>>b;
	ta[a]+=b;
	}
	int ans=0,ansi=0;
	for(int i=0;i<10000;i++)if(ans<ta[i])ans=ta[i],ansi=i;
	cout<<ansi<<" "<<ans<<endl;
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>
#include <complex>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }

typedef long long ll;
typedef double D;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }




int main() {
	int n; cin >> n;
	
	int ans1 = 10000, ans2 = 0;
	
	int a, b;
	for_(i, 0, n) {
		cin >> a >> b;
		if (ans2<b) {
			ans2 = b;
			ans1 = a;
		} else if (ans2==b) {
			ans1 = min(ans1, a);
		}
	}
	
	cout << ans1 << " " << ans2 << endl;
	
	return 0;
}

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

int main(){
	int n;
	cin>>n;
	int dt[n+1];
	dt[0]=0;
	for(int i=0;i<n;i++){
		int a,b;
		cin>>a>>b;
		dt[a]=b;
	}
	int maximum=0,cnt=0;
	for(int i=1;i<=n;i++){
		if(maximum<dt[i]){
			maximum=dt[i];
			cnt=i;
		}
	}
	cout<<cnt<<" "<<maximum<<endl;
	return 0;
}

C++: #include <cstdio>
#include <algorithm>
#include <map>
using namespace std;
int main(void){
  int n;
  scanf("%d",&n);
  pair<int,int> best = make_pair(0,0);
  for(int i = 0; i < n; i++){
    pair<int,int> p;
    scanf("%d %d",&p.second,&p.first);
    p.second *= -1;
    if(p > best) best = p;
  }
  printf("%d %d\n",-best.second,best.first);
}

C++: #include <iostream>

using namespace std;

int p[20];
int fish[20];

void buble_sort(int n){

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

	int temp1 = fish[j];
	fish[j] = fish[j-1];
	fish[j-1] = temp1;

	int temp2 = p[i];
	p[j] = p[j-1];
	p[j-1] = temp2;

      }
    }
  }


}

int main(void){

  int n;

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

  buble_sort(n);

  for( int i = n - 1 ; i > 0 ; i-- ){
    if( fish[i] != fish[i-1] ){
      cout << p[i] << " " << fish[i] << endl;
      return 0;
    }
  }
}

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


int main() {
    int n;
    cin>>n;
    int maxnum=-1,maxi=-1;
    rep(i,n){
        int a,b;
        cin>>a>>b;
        if(b>maxi || (a<maxnum && maxi==b)){
            maxi=b;
            maxnum=a;
        }
    }
    cout<<maxnum<<" "<<maxi<<endl;
    
    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;
	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]];
		}
	}
	for(int i=0;i<n;i++){
		if(max==a[m[i]]){
			cout << m[i] << " " << a[m[i]] << "\n";
		}
	}
	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(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<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int n, r[2];
    int max = 0, num = 20;
    cin >> n;
    rep(i,n){
        cin >> r[0] >> r[1];
        if(max < r[1]){
            max = r[1];
            num = r[0];
        }else if(max == r[1] && num > r[0]){
            num = r[0];
        }
    }
    cout << num << ' ' << max << endl;
}

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

using namespace std;

int main()
{
    int n, a, v;
    
    cin >> n;
    
    vector<int> c(n, 0);
    
    for(int i = 0; i < n; i++)
    {
        cin >> a >> v;
        
        c[a - 1] += v;
    }
    
    int ptr = -1, cnt = -1;
    
    for(int i = 0; i < n; i++)
    {
        if(cnt < c[i])
        {
            ptr = i;
            cnt = c[i];
        }
    }
    
    cout << ptr << ' ' << cnt << endl;
    
    return 0;
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int n;
  while (cin >> n) {
    vector<int> d(n);
    for (int i = 0; i < n; i++) {
      int a, v;
      cin >> a >> v;
      d[a - 1] = v;
    }
    int id = 0;
    for (int i = 0; i < n; i++) {
      if (d[i] > d[id]) id = i;
    }
    cout << id + 1 << " " << d[id] << endl;
  }

  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i = 0; i < (a); i++)
#define reps(i, a, b) for(int i = (a); i < (b); i++)
#define INF 1e9
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int, int> pii;
int main() {
	int n;
	vector<pii> v;
	cin >> n;
	rep(i, n) {
		int ind, a;
		cin >> ind >> a;
		v.push_back(make_pair(ind,a));
	}
	sort(v.begin(), v.end(), [](pii a,pii b) -> bool {
			if(a.second == b.second) return a.first < b.first;
			return a.second > b.second;
			});
	cout << v[0].first << " " << v[0].second << endl;
	return 0;
}