All problems

A Seaborn Bar Plot of Group Averages

easyPythonSeabornBar Plot

Tidewater Foods scores every delivery its depots make, so one depot can appear on many lines. The weekly bar chart shows one bar per depot at that depot's average score, because a depot that delivers twice as often should not get a taller bar for that reason alone. The report's opening line names the depot on top.

Task: Print the depot with the highest average score.

Input

The first line holds one integer n, the number of scored deliveries. Each of the next n lines holds a depot name and one score, separated by a single space. Depot names contain no spaces, and a depot may appear on many lines.

Output

One line holding a single depot name, exactly as it was read. A depot's figure is the average of its own scores, not their total, so a depot with two deliveries competes on equal terms with one that has twenty. If two depots tie, print whichever name comes first alphabetically.

Example:

Input:
4
A 10
A 20
B 100
B 50

Output:
B

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…