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<stdio.h>
 
int main(){
	int n, a, b, i, max = 0, num = 100;
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		scanf("%d %d", &a, &b);
		if(max <= b){
			max = b;
			if(max < b && num > a){
				num = a;
			}
		}
	}
	printf("%d %d", num, max);
	return 0;
}

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

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){
	int n;
	cin>>n;
	vector<pii> data;
	rep(i,n){
		int v,a;
		cin>>v>>a;
		data.push_back(pii(a,-v));
	}
	sort(data.begin(),data.end(),greater<pii>());
	int ans1 =data[0].first;
	int ans2 =-data[0].second;
	cout <<ans2<<" "<<ans1<<endl;
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a[101];
  int max=0;
  for(int i=0; i<n; i++) {
    int x,y;
    cin >> x >> y;
    a[y].push_back(x);
    if(max<y) max=y;
  }
  sort(a[max].begin(),a[max].end());
  cout << a[max][0] << " " << max << endl;
  return 0;
}

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

int main()
{
    int n;
    int p[21] = {};

    cin >> n;

    int max = 0;
    for( int i = 1; i <= n; i++ )
    {
        cin >> p[i] >> p[i];
        if( max < p[i] )
            max = p[i];
    }
    
    for( int i = 1; i <= n; i++ )
    {
        if( p[i] == max )
        {
            cout << i << " " << max << endl;
            break;
        }
    }

    return 0;
}

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 = 0; i <= n; i++){
		if (v2[i] == v[0]){
			printf("%ld %ld\n", i, v2[i]);
			break;
		}
	}
}

C++: #include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
#define sort(ss) sort(ss.begin(), ss.end())
#define rsort(ss) sort(ss.rbegin(), ss.rend())
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return acos(-1.0);
}
typedef set<int> set_i;
typedef set<string> set_s;
int INF=1000000;
int main(){
	int a,ac[30]={},win=0,ss,qq,i;
	cin>>ss;
	for(int e=0;e<ss;e++){
		cin>>a;
		cin>>ac[e];
		if(ac[e]>=win){
			if(ac[e]==win&&qq>a){
				qq=a;
			}
			else{
				win=ac[e];
				qq=a;
			}
		}
	}
	cout<<qq<<" "<<win<<endl;
}

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

bool compare(pair<int,int> a, pair<int,int> b) {
	if(a.second == b.second )
		return a.first < b.first;
	else
		return a.second > b.second;
}

int main() {
	vector<pair<int,int> > in;
	int n;

	cin >> n;
	
	for(int i = 0; i < n; i++) {
		pair<int,int> tmp;
		cin >> tmp.first >> tmp.second;
		in.push_back(tmp);
	}

	sort(in.begin(), in.end(), compare);
	cout << in[0].first << " " << in[0].second << endl;

	return 0;
}

C++: #include<iostream>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int n;
	cin>>n;
	int num;
	int fish;
	int ansnum;
	int ansfish=-1;
	rep(i,n){
		cin>>num>>fish;
		if(ansfish<fish){
			ansfish=fish;
			ansnum=num;
		}else if(ansfish==fish){
			if(ansnum>num){
				ansfish=fish;
				ansnum=num;
			}
		}
	}
	cout<<ansnum<<" "<<ansfish<<endl;
	return 0;
}

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

C++: #include<iostream>
using namespace std;
int main(){

  int n,a[20],v[20],b=0;

  cin >>n;

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

  for(int i=0 ; i < n ; i++){
    if(v[b] <= v[i] && a[b] > a[i]){
      b=i;
    }
  }

  cout <<a[b]<<" "<<v[b]<<endl;

  return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int n;
	int a[21],v[101];
	int i;
	int max=0,m;

	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&a[i],&v[i]);
		if(max<v[i]){
			max=v[i];
			m=a[i];
		}
	}
	printf("%d %d",m,max);
	return 0;
}

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

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

using namespace std;

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

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

typedef pair<int, int> P;

using namespace std;

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);
}