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<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-9;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
    int n;cin>>n;
    int ma=-1;int aa=INF;
    for(int i=0;i<n;i++){
        int a,v;cin>>a>>v;
        if(v>=ma){
            aa=min(aa,a);
            ma=v;
        }
    }
    cout<<aa<<" "<<ma<<endl;
}

C++: #include<iostream>
int a,v,M,A=99;main(){for(std::cin>>a;std::cin>>a>>v;)M<v&&(M=v)&(A=a);printf("%d %d\n",A,M); }

C++: #include<iostream>
using namespace std;
int main(){
  int n,mx,mxno,tmp,tab[20],ban[20];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>ban[i]>>tab[i];
  }
 
  for(int i=n-1;i>0;i--){
    for(int j=0;j<i;j++){
      if(ban[j]>ban[j+1]){
    tmp=tab[j+1];
    tab[j+1]=tab[j];
    tab[j]=tmp;
    tmp=ban[j+1];
    ban[j+1]=ban[j];
    ban[j]=tmp;
      }
    }
  }
 
 
  for(int i=n-1;i>0;i--){
    for(int j=0;j<i;j++){
      if(tab[j]<tab[j+1]){
    tmp=tab[j+1];
    tab[j+1]=tab[j];
    tab[j]=tmp;
    tmp=ban[j+1];
    ban[j+1]=ban[j];
    ban[j]=tmp;
      }
    }
  }
  mx=tab[0];
  mxno=ban[0];
  for(int i=1;i<n;i++){
    if(tab[i]>mx){
      mx=tab[i];
      mxno=ban[i];
    }
  }
  cout<<mxno<<" "<<mx<<endl;
}

C++: #include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
using namespace std;
int main(){
int n;
cin>>n;
vector<int>in;
vector<int>no;
rep(i,n){
int a,b;
cin>>a>>b;
pb(in,b);
pb(no,a);
}
rep(i,10*n){
rep(j,n-1){
if(in[j]<in[j+1]){swap(in[j],in[j+1]);swap(no[j],no[j+1]);}
if(in[j]==in[j+1]&&no[j]<no[j+1])swap(no[j],no[j+1]);
}
}
cout<<no[0]<<" "<<in[0]<<endl;
}

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

int main() {
	int n, nf, num , mnf, mnum;

	cin >> n;
	cin >> mnum >> mnf; n--;
	while (n--) {
		cin >> num >> nf;
		if (nf > mnf) {
			mnf = nf;
			mnum = num;
		}
	}
		cout << mnum << " " << mnf << endl;

		return 0;
	}

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

int main() {

  vector< pair< long long int, long long int > > cnt;

  long long int n;
  cin >> n;

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

    long long int in0, in1;
    cin >> in0 >> in1;
    cnt.push_back( make_pair( -in1, in0 ) );

  }

  sort( cnt.begin(), cnt.end() );

  cout << cnt[0].second << " " << -cnt[0].first << endl;

  return 0;

}

C++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
using namespace std;
int main(){
	
	int n;
	cin>>n;
	int maxa,maxb;
	
	int a,b;
	
	cin>>a>>b;
	
	maxa=a;
	maxb=b;
	
	for(int i=1;i<n;i++){
		cin>>a>>b;
		if(maxb<b){
			maxb=b;
			maxa=a;
		}
		else if(maxb==b){
			if(maxa>a)
				maxa=a;
		}
	}
	
	cout<<maxa<<" "<<maxb<<endl;
	



}

C++: #include <iostream>

using namespace std;

int info[21];

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>

using namespace std;

int main(){

	int n;
	int ary[101] , v[101];

	cin >> n;

	for(int i = 0; i < n; i++){
		cin >> ary[i];
		cin >> v[i];
	}

	for(int i = 0; i < n; i++){
		for(int j = 1; j <= n; j++){
			if(v[i] > v[j]){
				int tmp = v[i];
				v[i] = v[j];
				v[j] = tmp;

				int tmpn = ary[i];
				ary[i] = ary[j];
				ary[j] = tmpn;
			}
		}
	}

	cout << ary[1] << " " << v[1] << endl;

	return 0;
}

C++: #include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int main() {
  int N; cin >>N;
  map<int, int> m;
  REP(i, N){
    int a, v; cin >>a >>v;
    m[a] = v;
  }
  int ans = 0;
  for(auto i : m) if(i.second > m[ans]) ans = i.first;
  cout <<ans <<" " <<m[ans];
  return 0;
}

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[i];
	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 <bits/stdc++.h>

#define loop(v, f, l) for(int v = (f), v##_ = (l); v < v##_; ++v)

using namespace std;

typedef long long int lint;
static inline int in(){ int x; scanf("%d", &x); return (x); }
static inline lint inl(){ lint x; scanf("%lld", &x); return (x); }

int main()
{
	int n;
	int number;
	int getNum;
	int numOfGetFish[20] = {0};
	int winnerIndex = 0;
	int maxFish = 0;

	scanf("%d", &n);
	loop(i, 0, n)
	{
		scanf("%d%d", &number, &getNum);
		numOfGetFish[number - 1] += getNum;
	}
	loop(i, 0, n)
	{
		if( numOfGetFish[i] > maxFish )
		{
			winnerIndex = i + 1;
			maxFish = numOfGetFish[i];
		}
	}
	printf("%d %d\n", winnerIndex, maxFish);
	return (0);
}

C++: #include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-9;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
    int n;cin>>n;
    int ma=-1;int aa;
    for(int i=0;i<n;i++){
        int a,v;cin>>a>>v;
        if(v>ma){
            aa=a;
            ma=v;
        }
    }
    cout<<aa<<" "<<ma<<endl;
}