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++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  cin >> n;
  vpii v(n);
  rep(i, n) cin >> v[i].fi >> v[i].se;
  auto p = *max_element(all(v), [](pii a, pii b) {
    return a.se == b.se ? a.fi > b.fi : a.se < b.se;
  });
  cout << p.fi << ' ' << p.se << endl;
}

C++: //Name: Surf Smelt Fishing Contest
//Level: 1
//Category: やるだけ
//Note:

#include <iostream>

using namespace std;

bool solve() {
    int N;
    if(!(cin >> N)) return false;

    int winner, winner_v = -1;
    for(int i = 0; i < N; ++i) {
        int a, v;
        cin >> a >> v;
        if(v > winner_v || (v == winner_v && a < winner)) {
            winner = a;
            winner_v = v;
        }
    }
    cout << winner << ' ' << winner_v << endl;
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);

    while(solve()) ;
    return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int n;
	cin >> n;
	int maxn, maxs;
	cin >> maxn >> maxs;
	for (int i = 0; i < n - 1; i++){
		int a, b; cin >> a >> b;
		if (maxs < b){
			maxn = a;
			maxs = b;
		}
	}
	cout << maxn <<' '<< maxs << endl;
}

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[j];
	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 = 0 ; i < n; i++ )cout << p[i] << "---" << fish[i] << endl;

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

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PA;
using namespace std;
#define MAX 1000
int main(){
    int n; cin>>n;
    PA hoge; hoge.second=-INF;
    int a,b;
    rep(i,n){cin>>a>>b;if(b>hoge.second){hoge.second=b;hoge.first=a;}
        else if(hoge.second==b||hoge.first>a)hoge.first=a;};
    cout<<hoge.first<<" "<<hoge.second<<endl;
}

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

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

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[2];
	for(int i=0;i<n;i++){
		int b,c;
		cin>>b>>c;
		if(c==a[1])
			a[0]=min(a[0],c);
		if(c>a[1]){
			a[0]=b;
			a[1]=c;
		}
	}
	cout<<a[0]<<" "<<a[1]<<endl;
}

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

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

void solve(vector<P> v) {
	int minID, maxNum;
	minID = v[0].first;
	maxNum = v[0].second;
	for (int i = 1; i < v.size(); i++) 
		if (v[i].second > maxNum || (v[i].second == maxNum && v[i].first < minID)) {
			minID = v[i].first;
			maxNum = v[i].second;
		}

	cout << minID << " " << maxNum << endl;
}


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n, a, v;
	cin >> n;
	vector<P> fish;
	for (int i = 0; i < n; i++) {
		cin >> a >> v;
		fish.push_back(P(a, v));
	}
	solve(fish);
}

C++: #include<iostream>
a,v,A,V;main(){for(std::cin>>A;std::cin>>a>>v;)V^v?V<v&&(V=v)&(A=a):A>a&&(A=a);std::cout<<A<<" "<<V<<"\n";}

C++: #include <iostream>

using namespace std;

main(){
  int n, a, b, m = 0, d;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a >> b;
    if(m < b){
      m = b;
      d = a;
    }else if(m == b && d > a) d = a;
  }
  cout << d << ' ' << m << endl;
}

C++: #include<stdio.h>

int main(void){

int n,i,max=-1000000,max1,f[100],b[100];
scanf("%d",&n);
for(i=0; i<n; i++){
scanf("%d %d",&b[i],&f[i]);
if(max < f[i]){
max=f[i];
max1=b[i];
}
}

printf("%d %d\n",max1,max);
return 0;
}