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++: #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;


int main ()
{
	int N;
	int ansa = 0 , ansb = -1;
	cin >> N;
	int a , b;
	for( size_t i = 0; i < N; i++ )
	{
		cin >> a >> b;
		if( b > ansb )
		{
			ansa = a;
			ansb = b;
		}
		if( ansb == b &&a < ansa )
		{
			ansa = a;
		}
	}
	cout << ansa << " " << ansb << endl;
}

C++: #include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;

int main(){
  int n;
  int num=1,max=0;
  int tmpnum,tmp;
    cin>>n;
    while(n){
        cin>>tmpnum>>tmp;
        if(max==tmp){
            if(num>tmpnum){
                num=tmpnum;
                --n;
                continue;
            }
        }
        if(max<tmp){
            num=tmpnum;
            max=tmp;
        }
        --n;
    }
    cout<<num<<" "<<max<<endl;
  return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
int main()
{
	int n;
	cin >> n;
	int m[n+1];
	vector<int> vec;
	for(int i=0;i<n;i++)
	{
		int s;
		cin >> s;
		cin >> m[s];
		vec.pb(m[s]);
	}
	sort(vec.begin(),vec.end(),greater<int>());
	int t = vec[0];
	int b;
	for(int i=1;i<n+1;i++)
	{
		if(m[i]==t)
		{
			b=i;
			break;
		}
	}
	cout << b << ' ' << m[b] << endl;
	return 0;
}

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<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<cstdio>

int n;
int a[21],v[21];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d%d",&a[i],&v[i]);
	int mid=a[0],m=v[0];
	for(int i=1;i<n;i++){
		if(m<v[i]){
			mid=a[i];
			m=v[i];
		}
	}
	printf("%d %d\n",mid,m);
	return 0;
}

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 <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define rrep(i,n) for(int (i)=1;i<=(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



signed main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	
	int n;
	cin >> n;
	vector<P> a(n);
	rep(i, n) cin >> a[i].second >> a[i].first;
	sort(all(a));
	int A = a[n-1].second, B = a[n-1].first;
	for(int i = n-1; i >= 0; i--) {
		if(a[i].first == B) A = a[i].second;
		//cout << a[i].second << " " << a[i].first << endl;
	}
	cout << A << " " << B << endl;
 	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
	int num;
	cin >> num;
	int a,v,maxa=0,maxv=0;
	for(int i=0;i<num;i++){
		cin >> a >> v;
		if(maxv < v){
			maxv = v; maxa = a;
		}
	}
	cout << maxa << " " << maxv << endl;
}

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

C++: #include <iostream>
using namespace std;
int main(){
	for(int n,a,v=-1;cin>>n;cout<<a<<' '<<v<<endl)
		for(int i=0;i<n;i++){
			int x,y; cin>>x>>y;
			if(v<y||v==y&&a>x)
				a=x,v=y;
		}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m=0,a,b=100,d;
  cin>>n;
  while(n--){
    cin>>d>>a;
    if(m<a){
      m=a;
      b=d;
    }
      else if(m==a&&b>d)b=d;
  }
  cout<<b<<' '<<m<<endl;
}