cswork / OAOpen practice workspace

RobloxOA #10

Largest Value of Usage in Minutes

Estimated EasyJudge-ready

Topics (AI-labelled)Strings

Each record contains a five-letter lowercase device_id and a four-digit usage (leading zeros allowed); return the device ID with the largest usage. Device IDs are pairwise distinct, and so are the usage values.

Input

The first line contains n; each of the next n lines is device_id usage. This site's input protocol omits the comma and space of the original format to resolve the contradiction between its length=10 and the length of the example strings. 1≤n≤1400; each ID is exactly 5 lowercase English letters; usage is interpreted as an integer with 1≤usage≤1400 (the intersection of the original prose and constraints).

Output

Output the device_id with the largest usage.

Example 1

Input:

3
iqttt 0077
obvhd 0093
flohd 0075

Output:

obvhd

Example 2

Input:

1
abcde 0001

Output:

abcde

Example 3

Input:

2
zzzzz 1400
aaaaa 1399

Output:

zzzzz

Editorial

Loading solution…