while True:
T = int(input())
arr = [list(map(int, input().split())) for _ in range(100)]
arrCol = [0] * 100
arrRow = [0] * 100
arrCross1 = 0
arrCross2 = 0
for i in range(100):
for j in range(100):
arrCol[i] += arr[i][j]
arrRow[j] += arr[i][j]
if i == j:
arrCross1 += arr[i][i]
if i + j == 100:
arrCross2 += arr[i][j]
maxCol = arrCol[0]
maxRow = arrRow[0]
for i in range(100):
if maxCol < arrCol[i]:
maxCol = arrCol[i]
if maxRow < arrRow[i]:
maxRow = arrRow[i]
maxValues = [maxCol, maxRow, arrCross1, arrCross2]
result = 0
for i in range(4):
if result < maxValues[i]:
result = maxValues[i]
print(f"#{T} {result}")
if (T == 10):
break