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

Python: print(*sorted([list(map(int, input().split())) for _ in [0]*int(input())], key=lambda x:(-x[1],x[0]))[0])

Python: n = int(input())
av = [int(input().split()[1]) for _ in range(n)]	
maxv = max(av)
print(av.index(maxv)+1, maxv)

Python: from sys import stdin
n  = int(input())
book = [0]*(n+1)
for _ in stdin.read().splitlines() :
    a, v = map(int, _.split())
    book[a] += v
max_val = max(book)
print(book.index(max_val), max_val)

Python: n = int(input())
av = [0] * (n+1)
for _ in range(n):
	a, v = map(int, input().split())
	av[a] += v
maxv = max(av)
print(av.index(maxv), maxv)

Python: n = int(input())
d = {t[0]: t[1] for t in [list(map(int, input().split())) for _ in range(n)]}
print(*max(d.items(), key=lambda x: x[1]))

Python: n=int(input())
d={}
for _ in range(n):
  a,v=list(map(int,input().split()))
  if not v in d:
    d[v]=[a]
  else:
    d[v].append(a)
m=max(d.keys())
print(sorted(d[m])[0],m)

Python: n=int(input())
l=[]
for i in range(n):
	x,y=map(int,input().split())
	l.append((y,x))
l.sort(reverse=True)
print(l[0][1],l[0][0])

Python: d={}
for _ in[0]*int(input()):
 a,v=map(int,input().split())
 d[v]=d[v]if v in d and a>d[v]else a
m=max(d)
print(d[m],m)

Python: n = int(input())

alist = []
vlist = []
for _ in range(n):
    a, v = map(int, input().split())
    alist.append(a)
    vlist.append(v)

max = 0
num = 10**9
for a, v in zip(alist, vlist):
    if v > max:
        num = a
        max = v
    elif v == max:
        if a < num:
            num = a

print(num, max)

Python: #!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin, exit


def main(readline=stdin.readline):
    value = -1
    for _ in range(int(readline())):
        a, v = (int(s) for s in readline().split())
        if v > value:
            number = a
            value = v
    print(number, value)
    exit()


main()

Python: n = int(input())
av = [None] * n
for i in range(n):
    a, v = map(int, input().split())
    av[i] = [a, v]

av.sort()
ans = av[0][0]
for a, v in av:
    if av[ans - 1][1] < v:
        ans = a
print(ans, av[ans - 1][1])

Python: from operator import itemgetter
from collections import OrderedDict
n = int(input())
data = OrderedDict({i:0 for i in range(n,0,-1)})
for _ in range(n):
    a, v = [int(el) for el in input().split(' ')]
    data[a] += v
print(*max(data.items(), key=itemgetter(1)))

Python: #!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin, exit, maxsize


def main(readline=stdin.readline):
    value = -1
    number = maxsize
    for _ in range(int(readline())):
        a, v = (int(s) for s in readline().split())
        if v > value or v == value and a < number:
            number = a
            value = v
    print(number, value)
    exit()


main()

Python: from operator import itemgetter
n = int(input())
rs = [list(map(int,input().split())) for i in range(n)]
rs = sorted(rs,key=itemgetter(0))
print(' '.join(map(str, sorted(rs, key=itemgetter(1),reverse=True)[0])))

Python: n = int(input())
d = {}
for _ in range(n):
    a, v = map(int, input().split())
    d[a] = v
s = sorted(d.items(), key=lambda x: (x[1], x[0]))
maxv = s[-1][1]
for i in range(len(s)-1)[::-1]:
    if maxv != s[i][1]:
        print(*s[i+1])
        break

Python: 
n=int(input())
l=[]
for i in range(n):
	x,y=map(int,input().split())
	l.append((y,x))
l.sort(key=lambda x:(x[0],x[1]),reverse=True)
maximum=l[0][0]
young=l[0][1]
for i in l:
	if maximum==i[0]:
		young=i[1]
	else:
		break
print(young,maximum)



#print(l[0][1],l[0][0])

Python: n = int(input())

dic = {}
max_v = 0

for _ in range(n):
  a, v = map(int, input().split())
  if not v in dic or a < dic[v]:
    dic[v] = a
  if v > max_v:
    max_v = v

print(dic[max_v], max_v)

Python: a=[]
for i in range(int(input())):
    a.append(list(map(int,input().split(" "))))
a.sort(reverse=True)
a.sort(key=lambda x:x[1])
print(*a[-1])

Python: d={}
for _ in[0]*int(input()):
 a,v=map(int,input().split())
 d[v]=min(a,d[v])if v in d else a
m=max(d)
print(d[m],m)

Python: from operator import itemgetter
n = int(input())
rs = [list(map(int(),input().split())) for i in range(n)]
rs = sorted(rs,key=itemgetter(0))
print(' '.join(map(str, sorted(rs, key=itemgetter(1),reverse=True)[0])))

Python: n = int(input())
x, y = 20, 0
for _ in range(n):
    a, b = map(int, input().split())
    if y < b:
        x, y = a, b
    elif y == b and x >= a:
        x, y = a, b
print(x, y)

Python: from sys import stdin
book = [0]*(int(input())+1)
for _ in stdin.read().splitlines() :
    a, v = map(int, _.split())
    book[a] = v
max_val = max(book)
print(book.index(max_val), max_val)

Python: n=int(input())
nmb=21
r_m=0
for i in range(n):
    a,v=map(int,input().split())
    if r_m<v:
        nmb,r_m=a,v
    elif r_m==v:
        nmb=min(nmb,a)
print(nmb,r_m)

Python: d={}
for _ in[0]*int(input()):
 a,v=map(int,input().split())
 d[a]=v
m=max(d.items(),key=lambda x:x[1])
print(min(d[m]),m)

Python: d={}
for _ in[0]*int(input()):
 a,v=map(int,input().split())
 d.setdefault(v,[])
 d[v]+=[a]
m=max(d)
print(min(d[m]),m)

Python: n = int(input())
book = [0]*(n+1)
for _ in [None]*n  :
    a, v = map(int, input().strip().split())
    book[a] += v
max_val = max(book)
print(book.index(max_val), max_val)

Python: num = 1000
val = 0
n = int(input())
for i in range(n):
    a, b = map(int, input().split())
    if b > val or (b == val and a < num):
        val = b
        num = a
print(num, val)

Python: n = int(input())
ma = 20
mv = 0
while n > 0:
  a,v = map(int,input().split())
  if mv < v:
    ma,mv = a,v
  elif mv == v and ma >= a:
    ma,mv = a,v
  n -= 1
print(ma,mv)

Python: d={}
for _ in[0]*int(input()):
 a,v=map(int,input().split())
 d.setdefault(v,[])
 d[v]+=[a]
m=max(d)
print(d[m][0],m)

Python: n = int(input())
data = [0] * n
for _ in range(n):
    a, v = [int(el) for el in input().split()]
    data[a-1] += v
result = max(data)
print(data.index(result)+1, result)

Python: import operator
v = {}
n = int(input().strip())
for _ in range(n):
    i,ip = map(int,input().strip().split())
    v[i] = ip
w = sorted(v.items(),key=operator.itemgetter(1),reverse=True)
print("%d %d" % w[0])

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

C++: #include <iostream>
#include <cstdlib>
#include <climits>

using namespace std;

int main () {
  int n;
  cin >> n;

  int maxv = INT_MIN;
  int winner = INT_MIN;
  for( int i = 0; i < n; i++ ) {
    int a, v;
    cin >> a >> v;
    if( maxv <= v ) {
      winner = min( a, winner );
      maxv = v;
    }
  }
  cout << winner << " " << maxv << endl;

  return EXIT_SUCCESS;
}