matrix = [[int(j) for j in input().split()] for _ in range(int(input()))]
[print(f'{i + 1}:', max([abs(matrix[j][i]) for j in range(len(matrix))])) for i in range(len(matrix[0]))]
"По порядку"
mx = 0
for i in range(len(matrix[0])):
for j in range(len(matrix)):
if abs(matrix[j][i]) > mx:
mx = abs(matrix[j][i])
print(f'{i + 1}: {mx}')
matrix = [[int(j) for j in input().split()] for _ in range(int(input()))]
[print(f'{i + 1}:', max([abs(matrix[j][i]) for j in range(len(matrix))])) for i in range(len(matrix[0]))]
"По порядку"
matrix = [[int(j) for j in input().split()] for _ in range(int(input()))]
mx = 0
for i in range(len(matrix[0])):
for j in range(len(matrix)):
if abs(matrix[j][i]) > mx:
mx = abs(matrix[j][i])
print(f'{i + 1}: {mx}')
mx = 0