All problems

Overlaid Histograms by Category (hue)

mediumPythonSeabornhue

Calder Health runs two appointment systems side by side and wants to know whether one leaves patients waiting longer. Both groups' waits are drawn on the same axes in different colours, so the two shapes can be laid over each other rather than compared across a page. The line underneath names the group whose waits run higher on average.

Task: Print the group with the higher average wait.

Input

The first line holds one integer n, the number of patients. Each of the next n lines holds a group name and that patient's wait, separated by a single space. Group names contain no spaces, and a group may appear on one line or on many, so the two groups need not be the same size.

Output

One line holding a single group name, exactly as it was read. A group's figure is the average of its own waits, not their total, so a group with more patients gets no advantage from that alone. If two groups tie, print whichever name comes first alphabetically.

Example:

Input:
4
A 10
A 20
B 50
B 60

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…