Код (python 3.5):
n = int(input())
temp = input().split()
winner, maxtrees, minkicks = temp[0], int(temp[1]), int(temp[2])
for _ in range(n - 1):
temp = input().split()
contender, trees, kicks = temp[0], int(temp[1]), int(temp[2])
if trees > maxtrees or trees == maxtrees and kicks < minkicks:
winner, maxtrees, minkicks = contender, trees, kicks
print(winner)
Пример ввода:
4
Lennon 17 61
McCartney 17 58
Starr 18 74
Harrison 18 90
Пример вывода:
Starr