import sys from sys import stdin inf = float("inf") N = int(stdin.readline()) bits = [ [(inf,inf)] * (2**5) for i in range(2) ] points = [] for i in range(N): A = list(map(int,stdin.readline().split())) points.append(A) for j in range(2**5): x = 0 for k in range(5): if 2**k & j: x += A[k] else: x -= A[k] tup = (x,i) if bits[0][j] > tup: bits[1][j] = bits[0][j] bits[0][j] = tup elif bits[1][j] > tup: bits[1][j] = tup #bits[j] = min(bits[j] , (x , i) ) ans = [-inf] * N #print (bits) for i in range(N): for _,j in bits[0]+bits[1]: now = 0 for k in range(5): now += abs(points[i][k] - points[j][k]) ans[i] = max(ans[i] , now) print (*ans,sep="\n")