#C2633. Jedi Master Finder
Jedi Master Finder
Jedi Master Finder
You are given a list of candidates. Each candidate is represented by a name and a power level, separated by a space. Your task is to determine the candidate with the highest power level. In the event of a tie, choose the candidate whose name is lexicographically smallest.
The input is given via standard input and the output must be printed to standard output.
Mathematically, if we denote each candidate by a pair \((name, power)\), you should find \(candidate_{best}\) such that
[ candidate_{best} = \min_{name}{ candidate : power = \max(power) } ]
where \(\min_{name}\) indicates the lexicographically smallest name among those candidates that share the maximum power level.
inputFormat
The first line contains an integer \(N\), the number of candidates. Each of the next \(N\) lines contains a candidate's name and an integer representing their power level, separated by a space.
Example:
4 anakin 850 yoda 950 mace 950 obiwan 920
outputFormat
Print a single line containing the name of the Jedi candidate with the highest power level. If multiple candidates have the same power level, print the lexicographically smallest name.
## sample1
yoda 950
yoda