Woburn Challenge 2016-17 Round 2 - Junior Division
Lieutenant B'Elenne Terres is one unsatisfied Klingon. Her engineering working aboard the Starship Enterprise is all well and good, but what she really needs is a mate!
Fortunately for her, the Enterprise has happened across a Klingon colony, which has warriors living there. The warrior's name is (a unique string consisting of at most letters), and according to a survey which Terres has conducted, they've won battles and lost battles in their lifetime. She's not too concerned about which of the warriors actually happen to be single at the time.
Any warrior who has lost at least one battle would clearly not make a suitable mate - weakness is unacceptable. Of the warriors who have never lost any battles, the perfect mate is the one who has won the greatest number of battles. If multiple suitable warriors have won the same number of battles, then the one earliest in the list of warriors is preferable.
Please help Terres determine the name of this perfect mate! Of course, it's also possible that there's no such mate, if none of the warriors are suitable.
Input Specification
The first line of input consists of a single integer .
lines follow, with the of these lines consisting of a single
string , followed by a space, followed by two space-separated
integers and (for ).
Output Specification
Output a single line consisting of a single string - either the name of
the perfect mate, or None
if there are no suitable mates.
Sample Input 1
5
Mereg 7 0
Werf 15 10
Kehless 14 0
Kerek 14 0
Stex 2 3
Sample Output 1
Kehless
Sample Input 2
1
Jacob 100 1
Sample Output 2
None
Comments