for i in range(5):
if i == 0:
score = {i+1 : sum(map(int, input().split()))}
else:
score.update({i+1 : sum(map(int, input().split()))})
print(max(score, key=score.get), score[max(score, key=score.get)])
for i in range(5):
if i == 0:
score = {i+1 : sum(map(int, input().split()))}
else:
score.update({i+1 : sum(map(int, input().split()))})
print(max(score, key=score.get), score[max(score, key=score.get)])