League Champion
Match results are given as teamA goalsA teamB goalsB. A win earns 3 points, a draw 1 each, a loss 0. Print the champion; ties break alphabetically.
Input: the first line has N; each of the next N lines has one match result.
Output: the champion's name.
Constraints:
- 1 ≤ N ≤ 2×104
- lowercase team names
Sample Tests
Input 1
3 ant 2 bee 1 bee 3 cat 3 cat 1 ant 0
Output 1
cat
Input 2
1 dog 0 fox 0
Output 2
dog
Discussion (opens after you solve — no spoilers before)
No comments yet.