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: from sys import stdin
n = int(input())
book = [0]*(n+1)
for _ in stdin.readlines()  :
        if 0 not in book : break 
        a, v = map(int, _.split())
        book[a] = v+1
max_val = max(book)
print(book.index(max_val), max_val-1)

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

Python: # -*- coding: utf-8 -*-

import sys
import os
import math

N = int(input())

A = [None] * N
for i in range(N):
    id, num = map(int, input().split())
    id -= 1
    A[id] = num

max_value = max(A)
max_index = A.index(max_value)
print(max_index + 1, max_value)

Python: # -*- coding: utf-8 -*-

import sys
import os
import math

N = int(input())

A = []
for i in range(N):
    id, num = map(int, input().split())
    A.append(num)

max_value = max(A)
max_index = A.index(max_value)
print(max_index + 1, max_value)

Python: n = int(input())
a = [0 for i in range(n)]
v = [0 for i in range(n)]

for i in range(n):
    a[i], v[i] = [int(i) for i in input().split()]
v1 = sorted(v)
v2 = [v.index(i) for i in v1]
print(a[v2[-1]],v1[-1])

Python: a={}
for i in range(int(input())):
    b,c=map(int,input().split())
    a[b]=c
print(*max(a.items(),key=lambda x:x[1]))

Python: # AOJ 0095 Surf Smelt Fishing Contest
# Python3 2018.6.21 bal4u

n = int(input())
tbl = [0]*(n+1)
vmax = 0
for i in range(n):
	a, v = list(map(int, input().split()))
	tbl[a] += v
	if tbl[a] > vmax: vmax = tbl[a]

for i in range(1, n+1):
	if tbl[i] == vmax:
		print(i, vmax)
		break

Python: n = int(input())
a = [0 for i in range(n)]
v = [0 for i in range(n)]

for i in range(n):
    a[i], v[i] = [int(i) for i in input().split()]
v1 = sorted(v)
max_ = v1[-1]
indexes = [i for i, x in enumerate(v) if x == max_]
a_ = min([a[i] for i in indexes])
print(a_,max_)

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())
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: N = int(input())
maxA = -1
maxV = -1
for l in range(N):
    a,v = [int(i) for i in input().split()]
    if v > maxV:
        maxV = v
        maxA = a
print(maxA, maxV)

Python: # Aizu Problem 0095: Surf Smelt Fishing Contest
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


N = int(input())
A = sorted([[int(_) for _ in input().split()] for __ in range(N)], key=lambda x: (-x[1], x[0]))
print(A[0][0], A[0][1])

Python: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0095
"""
import sys


def main(args):
    winner = [-1, -1]
    n = int(input())
    for _ in range(n):
        a, v = [int(x) for x in input().strip().split(' ')]
        if v > winner[1]:
            winner[0] = a
            winner[1] = v
        elif v == winner[1]:
            if a < winner[0]:
                winner[0] = a
    print('{} {}'.format(winner[0], winner[1]))


if __name__ == '__main__':
    main(sys.argv[1:])

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

Python: n = int(input())
ans=[-1]*21
for _ in range(n):
    a, b = map(int, input().split())
    ans[a] = b

print(ans.index(max(ans)), max(ans))

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

Python: N=int(input())
number={}
for i in range(N):
    a,b=map(int,input().split())
    number[a] = b
number_max = max(number.values())
answer = []
for v,m in number.items():
    if m==number_max:
        answer.append(v)
print(min(answer),number_max)

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)

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

Python: num = int(input())

L = []
for i in range(num):
    p, v = [int(x) for x in input().split()]
    L.append([p, v])

L.sort(key=lambda x: (-x[1],x[0]))

print(L[0][0],L[0][1])

Python: a={}
for i in range(int(input())):
    b,c=map(int,input().split())
    a[b]=c
d=max(a.items(),key=lambda x:x[1])
print(*d)

Python: while True:
	try:
		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])
	except EOFError:
		break

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])[0]
print(m,min(d[m]))

Python: N = int(input())
n, a = -1, 0
for x in sorted([list(map(int, reversed(input().split()))) for i in range(N)], reverse=True):
    if x[0] < n:
        break
    n, a = x
print(a, n)

Python: n = int(input())
result = []
for i in range(n):
    result.append(list(map(int, input().split())))
result.sort(key=lambda x: (-x[1], x[0]))
print(*result[0])

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

Python: N = int(input())
maxA = -1
maxV = -1
for l in range(N):
    a,v = [int(i) for i in input().split()]
    if v > maxV:
        maxV = v
        maxA = a
    elif v == maxV:
        maxA = min(a, maxA)
print(maxA, maxV)

Python: n = int(input())
fish = []
for i in range(n) :
    a, v = map(int, input().split())
    fish.append([a, v])
    
fish.sort(key = lambda val: val[0])
fish.sort(reverse = True, key = lambda val: val[1])
print(*fish[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: 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: d={}
for _ in[0]*int(input()):
 a,v=map(int,input().split())
 d[a]=v
print(*max(d.items(),key=lambda x:x[1]))

Python: n = int(input())
a = [0 for i in range(n)]
v = [0 for i in range(n)]

for i in range(n):
    a[i], v[i] = [int(i) for i in input().split()]
v1 = sorted(v)
v2 = [v.index(i) for i in v1]
print(v2[-1]+1,v1[-1])

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

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