Finding the Easiest Problem
InterviewTime limit1sMemory limit1024 MB
Read N titles with distinct difficulties and print the title whose difficulty is the smallest.
- Level
Easy1 of 10
- Topics
- Implementation, Array
- Solved
- No attempts yet
Problem
If you reviewed the preliminary round problems carefully, you noticed that the 5 problems from the preliminary round are sorted in order of difficulty.
The final round, however, sorts problems by title in lexicographic order, so the problems may not be sorted in order of difficulty.
Given problem titles and difficulties, write a program that prints the title of the easiest problem.
A problem's difficulty is expressed as a natural number, and a larger number means a harder problem.
Input
The first line gives the number of problems .
Each of the next lines gives a problem title and its difficulty, separated by a space.
Output
Print the title of the easiest problem.
Constraints
- A problem title consists only of uppercase English letters.
- A problem title is at most 10 characters long, and all problem titles are distinct.
- A problem's difficulty is a natural number from 1 to 4, and all difficulties are distinct.
- The problems are given in lexicographic order of their titles.