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 <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;
		}
		else if(b == mx_n && a < mx_p)
		{
			mx_p = a;
		}
	}

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

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

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

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
   int n,men,fish,num,fishmax;
   cin>>n;
   for(int i=0;i<n;i++){
    cin>>men>>fish;
    if(i==0){
        num=men;
        fishmax=fish;
    }
    else {
        if(fish>fishmax){
            fishmax=fish;
            num=men;
        }
        else if(num>men)num=men;
    }
   }
   cout<<num<<" "<<fishmax<<endl;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;
int a,b,ma,ans,n;
int main(){
    cin>>n;
    cin>>a>>b;
    ma=b,ans=a;
    for(int i=1;i<n;i++){
        cin>>a>>b;
        if(ma<b){
            ans=a;
            ma=b;
        }else if(ma==b&&ans>a)ans=a;
    }
    cout<<ans<<" "<<ma<<endl;
return 0;
}

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

struct wakasagi {
    int a, v;
    wakasagi(int A, int V) : a(A), v(V) {};
};

bool operator <(wakasagi A, wakasagi B) {
    if (A.v != B.v) return A.v < B.v;
    else return A.a > B.a;
}

int main()
{
    int n, a, v;
    cin >> n;
    vector<wakasagi> vec;
    for (int i = 0; i < n; ++i) {
        cin >> a >> v;
        vec.push_back(wakasagi(a, v));
    }
    vector<wakasagi>::iterator top =
        max_element(vec.begin(), vec.end());
    cout << top->a << " " << top->v << endl;
}

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

int main(){
	int fishNum[20];
	int array[20];
	int num;
	int hoge;

	cin >> num;
	for(int i=0; i < num; i++) cin >> hoge >> fishNum[i];
	for(int i=0; i < num; i++) array[i] = fishNum[i];

	sort(array, array+num, greater<int>());


	for(int i=0; i < num; i++){
		if(array[0] == fishNum[i]){
			cout << i+1 << " " << array[0] << endl;
			break;
		}
	}

}

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

struct P{
    int num;
    int fish;
    static bool more(const P& left,const P& right){
        return left.fish > right.fish;
    }
    static bool numless(const P& left,const P& right){
        return left.num < right.num;
    }
};

int main(){
    int n;
    cin >> n;
    vector <P> data;
    P ls[n];
    for(int i=0;i<n;i++){
        cin >> ls[i].num >> ls[i].fish;
        data.push_back(ls[i]);
    }
    sort(data.begin(),data.end(),P::numless);
    sort(data.begin(),data.end(),P::more);
    cout << data[0].num << " " << data[0].fish << endl;
}

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



int n, a, v;

int main() {
    while (cin >> n) {
        int Max = -1, pMin = 1000;
        for (int i = 0; i < n; ++i) {
            cin >> a >> v;
            if (Max < v) { Max = v, pMin = a; }
            else if (Max == v) { chmin(pMin, a); }
        }
        cout << pMin << " " << Max << endl;
    }
    return 0;
}

C++: #include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{	
	int n,a,v,mx,mn,i;
	scanf("%d",&n);
	mx=-1;
	for(i=0;i<n;i++)	{
		scanf("%d %d",&a,&v);
		if(mx<v || (mx==v && mn>a))	{
			mx=v;	mn=a;
		}
	}
	printf("%d %d\n",mn,mx);
	return 0;
}