n = int(input())
ABCDE = [list(map(int,input().split())) for i in range(n)]

ans = [0]*n

for i in range(1<<5):
    if i & 1:
        continue

    l = []
    mi = 10**30
    ma = -10**30
    for j in range(n):

        num = 0
        for x in range(5):
            if i >> x & 1:
                num += ABCDE[j][x]
            else:
                num -= ABCDE[j][x]

        l.append(num)
        mi = min(mi,num)
        ma = max(ma,num)

    for ind,x in enumerate(l):
        ans[ind] = max(ans[ind],ma-x,x-mi)
for i in ans:
    print(i)