Hide

Problem D
Besta gjöfin

Languages en is
/problems/bestagjofin/file/statement/en/img-0001.jpg
Image from flickr.com

Sigrún got a lot of presents from all the guests that attended her birthday party today. She has opened all the gifts and noticed that they weren’t equally fun.

She made a list of all the gifts she got, from whom she got each gift and a number denoting how much she enjoyed the gift — the higher the number, the more fun the gift is.

Can you help Sigrún find who gave her the most fun gift?

Input

The first line contains a single integer $n$ ($1 \leq n \leq 1\, 000$), the number of guests who attended the party and gave Sigrún a gift. Then there are $n$ lines, each containing the name of a guest and an integer denoting how fun the gift from this guest was. Each name only contains English letters, no spaces and is at most $20$ characters long. Furthermore, each integer is in the interval $0$ to $1\, 000$. No two values are the same.

Output

Print a single line containing the name of the guest that gave Sigrún the most fun gift.

Scoring

Group

Points

Constraints

1

25

There are exactly three guests.

2

75

No further constraints.

Sample Input 1 Sample Output 1
3
Arnar 10
Bjarki 8
Bernhard 15
Bernhard
Sample Input 2 Sample Output 2
2
BjarniJokull 124
GunnarJonas 123
BjarniJokull

Please log in to submit a solution to this problem

Log in