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 <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

////////////////*My library*////////////////////////
#define rep_to(a,i,n) for(i=a;i<n;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define rep_r(i,n) for(i=n-1;i>=0;i--)
#define debug_i(x) printf("x:%d\n",x)
#define debug_s(str) printf("str:%s\n",str)
#define debug_c(c) printf("c:%c\n",c)
#define s_i1(x) scanf("%d",&x)
#define s_i2(x,y) scanf("%d %d",&x,&y)
#define s_i3(x,y,z) scanf("%d %d %d",&x,&y,&z)
////////////////////////////////////////////////////
////////////////////////
/*prime()*/
/*primecount()*/
/*sort()*/
///////////////////////

int main()
{
	int i,j,k;
	int n,q;
	int x,y,num=0,sd_num=0;
	double max=0,sd_max=0;
	int a[100000]={},v[100000]={};

	s_i1(n);
	rep(i,n)
	{
		scanf("%d %d",&x,&y);
		v[x]+=y;

		num=(max<v[x])? x : num;
		max=fmax(v[x],max);
	}
	printf("%d %d\n",num,(int)max);
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int n, a, v, maxa = 0, maxv = 0;

	cin >> n;

	for (int i=0; i<n; i++)
	{
		cin >> a >> v;

		if(v > maxv){
			maxa = a;
			maxv = v;
		}
	}

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

	return 0;
}

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

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

void solve()
{
	int n;
	cin >> n;
	vector<p> list(n);
	for(int i = 0; i < n; ++i)
	{
		cin >> list[i].second >> list[i].first;
	}
	sort(list.begin(), list.end());
	int max_point = list[n - 1].first;
	int min_num = 99999;
	for(int i = 0; i < n; ++i)
	{
		if(max_point == list[n - 1].first)
		{
			if(min_num > list[n - 1].second)
			{
				min_num = list[n - 1].second;
			}
		}
	}
	cout << min_num << " " << max_point << endl;
}

int main()
{
	solve();
	return(0);
}

C++: #include <iostream>
using namespace std;
int main(){
	int n[20],num,a,z,max=0;
	cin>>num;
	for(int i=0;i<num;i++){
		cin>>a>>n[i];
		if(max<n[i]){
			z=a;
			max=n[i];
		}
	}
	cout<<z<<" "<<max<<endl;
	return 0;
}

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int dx[8] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dy[8] = {0, -1, 0, 1, -1, 1, -1, 1};

int main() {
  int n;
  map<int, int> p;

  cin >> n;
  REP(i, n) {
    int a, v;
    cin >> a >> v;
    p.insert(MP(v, a));
  }

  map<int, int>::iterator it = p.end();  
  it--;
  map<int, int>::iterator ans = it;
  int max = it->first;
  while(max <= it->first) {
    if(it->second > ans->second) ans = it;
    it--;
  }

  cout << ans->second << ' ' << ans->first << endl;
}

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,a[1000],max=0;
	a[0]=-1;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> m;
		cin >> a[m];
	}
	rep(i,0,n+1){
		if(max<a[i]){
			max=a[i];
		}
	}
	rep(i,0,n+1){
		if(max == a[i]){
			cout << i << " " << a[i] << "\n";
		}
	}
	return 0;
}

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

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

	int t[20][2];
	vector<int> res;
	rep(i,n)
	{
		int a,v;
		cin >> a >> v;
		t[i][0] = a;
		t[i][1] = v;
		res.push_back(v);
	}

	sort(res.begin(),res.end(),greater<int>());

	rep(i,n)
	{
		if(t[i][1] == res[0])
		{
			cout << t[i][0] << " " << res[0] << endl;
			return 0;
		}
	}
	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;
    cin >> n;
    rep(i,n){
        cin >> r[0] >> r[1];
        if(max < r[1]){
            max = r[1];
            num = r[0];
        }
    }
    cout << num << ' ' << max << endl;
}

C++: #include<bits/stdc++.h>
using namespace std;
int n,a,v,cnt[21],maxcnt;

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

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

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

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

int main()
{
  int a[21], b[21];
  int n;
  int max = 0;
  int min = 1000;
  cin >> n;
  for (int i = 1; i <= n; i++){
    cin >> a[i] >> b[i];
    if (b[i] >= max){
      max = b[i];
    }
  }
  
  for (int i = 1; i <= 6; i++){
    if (b[i] == max){
      if (min > i){
        min = i;
      }
    }
  }

  cout << min << " " << max;

  return 0;

}

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

int main(){
	int n;
	cin>>n;
	int dt[n+1];
	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;
}