import sys
input = sys.stdin.read().strip().split("\n\n")
elves = sorted(sum(int(i) for i in elf.split("\n")) for elf in input)
print("Part 1:", elves[-1])
print("Part 2:", sum(elves[-3:]))