count_easter_bread = int(input())
best_score = 0
best_chief = ""
count_chiefs = 0
name_chief = ""
while name_chief != "Stop":
name_chief = input()
total_points = 0
while True:
command = input()
if command == "Stop":
break
else:
point = int(command)
total_points += point
print(f"{name_chief} has {total_points} points.")
if total_points > best_score:
best_score = total_points
best_chief = name_chief
print(f"{name_chief} is the new number 1!")
count_chiefs += 1
if count_easter_bread == count_chiefs:
break
print(f"{best_chief} won competition with {best_score} points!")