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<iomanip>
#include<cstdlib>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int qx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int qy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	ll n, q;
	cin>>n>>q;
	vector<ll> hoge(n, 0);
	vector<P> hogeho(n);
	REP(i, n) {
		hogeho[i].first = 0;
		hogeho[i].second = i;
	}
	REP(i, q) {
		ll a, v;
		cin>>a>>v;
		--a;
		ll gomi = hoge[a];
		hoge[a] += v;
		vector<P>::iterator ite;
		ite = lower_bound(ALL(hogeho), P(gomi, a));
		(*ite).first = hoge[a];
		sort(ALL(hogeho));
		ite = lower_bound(ALL(hogeho), P(hogeho[hogeho.size() - 1].first, 0));
		cout<<(*ite).second + 1<<" "<<(*ite).first<<endl;
	}
}

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

int main(void){

  int n;
  int max = 0;
  int num = 0;

  cin >> n;

  for( int i = 0 ; i < n ; i++ ){

    int a = 0,v = 0;

    cin >> a >> v;

    if( max < v ){
      
      max = v;
      num = a;

    }

  }

  cout << num << " " << max << endl;

  return 0;

}

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

int main() {
  int n, a, b, max_a, max_b;
  scanf("%d", &n);
  max_a = max_b = -1;
  for (int i=0; i<n; i++) {
    scanf("%d %d", &a, &b);
    if (max_b<b) {
      max_b = b;
      max_a = a;
    } else if (max_b==b && max_a>a) {
      max_a = a;
    }
  }
  printf("%d %d\n", max_a, max_b);
  return 0;
}

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

int a[20], idx, mx;

int main()
{
    int n; cin >> n;
    for(int i=0, index=0;i < n; ++i) {
        cin >> index >> a[index-1];
        if (mx < a[index-1]) idx = index-1, mx = a[index-1];
    }

    cout << idx+1 << " " << mx << endl;

    return 0;
}

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

int main(void){
  int n,num,w;
  pair<int,int> p[20];  

  cin >> n;
  for(int i = 0 ; i < n ; i++){
    cin >> num >> w;
    p[i] = make_pair(-w,num);
  }
  sort(p,p+n);
  cout << p[0].second << ' ' << (-1)*p[0].first << 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[i])
        {
            ptr = i;
            cnt = c[i];
        }
    }
    
    cout << ptr + 1 << ' ' << cnt << endl;
    
    return 0;
}

C++: #include <iostream>

using namespace std;

int info[22];

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

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> a >> v;
        info[a] = v;
    }
    
    for (int i = 1; i <= n; i++)
        if (info[max_idx] < info[i])
            max_idx = i;
    cout << max_idx << " " << info[max_idx] << endl;

    return 0;
}

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

int main(){
    int n;
    cin >> n;
    pair <int,int> data[20];
    for(int i=0;i<n;i++) {
        cin >> data[i].second >> data[i].first;
    }
    sort(data,data + n);
    cout << data[n-1].second << " " <<  data[n-1].first << endl;
}

C++: #include <cstdio>
#include <algorithm>

using namespace std;

int main(){
	int n;
	long a, b;
	long v[110] = {0}, v2[110] = {0};
	
	scanf("%d", &n);
	
	for (int i = 1; i <= n; i++){
		scanf("%ld %ld", &a, &b);
		v[a] += b;
		v2[a] += b;
	}
	
	sort(v, v + n + 1);
	reverse(v, v + n + 1);
	
	for (int i = 1; i <= n; i++){
		if (v2[i] == v[0]){
			printf("%ld %ld\n", i, v2[i]);
			break;
		}
	}
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

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

typedef long long ll;

int main()
{
	int n;
	int a, b;
	int mx_p, mx_n = -1;

	cin >> n;

	for(int i = 0;i  < n;  i++)
	{
		cin >> a >> b;
		if(b > mx_n)
		{
			mx_p = a;
			mx_n = b;
		}
	}

	printf("%d %d\n", mx_p, mx_n);
}

C++: #include <iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int max=0; int kouho =0;
    int a,b;
    for(int i=0;i<n;i++){
        cin >> a >> b;
        if(max < b){
            max = b;
            kouho = a;
        }
    }
    cout << kouho << " " << max << endl;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	for(int n;cin>>n;){
		pair<int,int> p[20];
		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*-1<<endl;
	}
	return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

const int INF = 1 << 24;
const int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};

typedef unsigned long long ull;
typedef std::pair<int,int> P;

bool compare(const P& lp, const P& rp){
    if(lp.second == rp.second){
        return lp.first > rp.first;
    }
    return lp.second < rp.second;
}

int main(){
    int N;
    std::cin >> N;

    std::vector<P> V;
    REP(i, N){
        int a, v;
        std::cin >> a >> v;
        V.push_back({a, v});
    }

    std::sort(V.rbegin(), V.rend(), compare);

    std::cout << V[0].first << " " << V[0].second << std::endl;
}

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

int main() {
	int n;
	int x[20];
	int y[20] = {};
	cin >> n;

	for (int i = 0;i < n;i++) {
		int a, v;
		cin >> a >> v;
		x[a - 1] = v;
		y[a - 1] = x[a - 1];
	}
	sort(y, y + n);
	for (int i = 0;i < 20;i++) {
		if (y[n-1] == x[i]) {
			cout << (i + 1) << ' ' << x[i] << endl;
			break;
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <queue>


typedef std::pair<int, int> P;
int n;

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

    std::priority_queue<P> que;
    for(int i = 0; i < n; i++){
        int a, b;
        scanf("%d %d", &a, &b);
        que.push(P(b, a));
    }

    P p = que.top();
    printf("%d %d\n", p.second, p.first);

    return 0;
}

C++: #include <iostream>

using namespace std;

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

  int amin = 0;
  int vmax = -1;
  for (int i = 0; i < n; ++i) {
    int a, v;
    cin >> a >> v;
    if (v < vmax || (v == vmax && amin < a))
      continue;
    amin = a;
    vmax = v;
  }
  cout << amin << " " << vmax << endl;
}