cswork / OAOpen practice workspace

ZipRecruiterOA #3

Coderwriting

Estimated EasyJudge-ready

Topics (AI-labelled)HashingStrings

You are given student grades; each student appears at least once, and grades are 1 to 5. Find the student with the highest average grade; different students have different averages.

Input

The first line contains n (1..100000), followed by n lines, each with a name (English letters, no spaces, case-sensitive) and a grade (1..5).

Output

Output the name of the student with the highest average grade.

Example 1

Input:

5
John 5
Michael 4
Ruby 2
Ruby 5
Michael 5

Output:

John

Example 2

Input:

6
Kate 5
Kate 5
Maria 2
John 5
Michael 4
John 4

Output:

Kate

Example 3

Input:

5
A 5
A 5
B 4
B 4
B 4

Output:

A

Editorial

Loading solution…