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 <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
typedef pair<int, int> P;

int main(){
  int N;
  while(cin >> N && N){
    vector<P> v(N);
    REP(i, N) {
      int a, t;
      cin >> a >> t;
      v[i] = P(-t, a);
    }
    sort(v.begin(), v.end());
    printf("%d %d\n", v[0].second, -v[0].first);
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int n; cin>>n;
	int a=0,v=0;
	for(int i = 0; i < n; ++i)
	{
		int aa,vv;
		cin>>aa>>vv;
		if(v<vv)
		{
			a=aa; v=vv;
		}
		else
		{
			if(aa<a)
			{
				a=aa;
			}
		}
	}
	cout<<a<<" "<<v<<endl;
  return 0;
}

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

C++: #include <cstdio>

using namespace std;

int main()
{
 int n;
 int a[20], v[20];
 scanf("%d", &n);

 for (int i = 0; i < n; i++) scanf("%d %d", a + i, v + i);

 int ai = 9999, vi = -1;

 for (int i = 0; i < n; i++){
  if (v[i] >= vi){
    vi = v[i];
    if (ai > a[i]) ai = a[i];
  }
 }
 return (!printf("%d %d\n", ai, vi));
}

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

int main(){
  int n,a,v,max=0,maxn;

  cin >>n;
  for(int i=0;i<n;++i){
    cin >>a >>v;
    if(v>max){
      max=v;
      maxn=a;
    }
  }
  cout <<maxn <<" " <<max <<'\n';
  return 0;
}

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

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef pair<int, int>P;

map<int, int>mp;
int main() {
	int n, q; cin >> n >> q;
	rep(i, q) {
		int a, v; cin >> a >> v;
		mp[a] += v;
		vector<P>V;
		for (P i : mp)V.push_back(i);
		stable_sort(V.begin(), V.end(), [](P a, P b) {return a.second>b.second; });
		cout << V[0].first << ' ' << V[0].second << endl;
	}

}

C++: #include <iostream>
#include <queue>
#include <map>

using namespace std;

typedef pair<int, int> P;

int n;
int fish[1000001];

int main() {
    cin >> n;

    priority_queue<P> pq;

    for(int i = 0; i < n; i++) {
        int a, v;
        cin >> a >> v;
        fish[a] += v;
        pq.push(P(fish[a], a * (-1)));
    }

    P p = pq.top();
    cout << p.second * (-1) << " " << p.first << endl;
    return 0;
}

C++: //
//  main.cpp
//  ggggggggggggggggggggggggggggggggggggg
//
//  Created by h3037175 on 2017/08/01.
//  Copyright ?? 2017??´ h3037175. All rights reserved.
//

#include <iostream>
using namespace std;
int main() {
    int n,a,v,max=-100000,num;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a>>v;
        if(max<v || max==v&&num>a){
            max=v;
            num=a;
        }
    }
    cout<<num<<" "<<max<<endl;
    return 0;
}

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[a - 1])
        {
            ptr = i;
            cnt = c[a - 1];
        }
    }
    
    cout << cnt << ' ' << ptr << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
	int n,v,a;
	int max=0,ans=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>v;
		if(max<v){
			ans=a;
			max=v;
		}else if(max==v){
			if(ans>a){
				ans=a;
			}
		}
	}
	cout<<ans<<" "<<max<<endl;
}

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

struct P{
    int num;
    int fish;
    static bool more(const P& left,const P& right){
        return left.fish > right.fish;
    }
};

int main(){
    int n;
    cin >> n;
    vector <P> data;
    P ls[n];
    for(int i=0;i<n;i++){
        cin >> ls[i].num >> ls[i].fish;
        data.push_back(ls[i]);
    }
    sort(data.begin(),data.end(),P::more);
    cout << data[0].num << " " << data[0].fish << endl;
}

C++: #include <iostream>
using namespace std;
 
struct person {
    int a;
    int v;
};
int main() {
    struct person man[25],max;
    max.a=max.v=-1;
    int n;
    cin>>n;
    while(n--){
        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>
using namespace std;

int main()
{
	int n;
	while( cin >> n ){
		int ansA, ansV;
		ansA = 100, ansV = 0;
		for( int i = 0; i < n; ++i ){
			int a, v;
			cin >> a >> v;
			if( ansV < v ){
				ansA = a;
				ansV = v;
			}else if( ansV == v && ansA > a ){
				ansA = a;
			}
		}
		cout << ansA << " " << ansV << endl;
	}

	return 0;
}

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

int main() 
{
	map<int, int>s;
	int a;
	cin >> a;
	for (int b = 0; b < a; b++) {
		int c, d;
		cin >> c >> d;
		if (s[d] > c||s[d]==0)s[d] = c;
	}
	auto e = s.end();
	e--;
	cout << e->second << " " << e->first << endl;
}

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

int main()
{
    int number,score,n;
    int winnerNumber,winnerScore = -1;

    cin >> n;

    for(int i=0; i<n; i++){
        cin >> number >> score;

        if(score > winnerScore ){
            winnerScore = score;
            winnerNumber = number;
            continue;
        }
        if(score == winnerScore && number < winnerNumber){
            winnerScore = score;
            winnerNumber = number;
        }
    }

    cout << winnerNumber << ' ' << winnerScore << endl;

    return 0;
}

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

#define N 20

int main(void) {
	int n;
	int p[N + 1]; //添え字が参加者番号、値は釣った匹数
	int a, v;
	int ans;
	
	cin >> n;
	
	for(int i = 0; i < n; ++i) {
		cin >> a >> v;
		p[a] = v;
	}
	
	ans = 1;
	for(int i = 1; i <= n; ++i) {
		if(p[ans] < p[i]) ans = i;
	}
	
	cout << ans << ' ' << p[ans] << endl;
	
	return 0;
}