from sys import stdin input=lambda :stdin.readline()[:-1] import itertools sgns=[i for i in itertools.product([-1,1],repeat=5) if i[0]==1] n=int(input()) a=[list(map(int,input().split())) for i in range(n)] ans=[0]*n for sgn in sgns: S=[0]*n for i in range(n): res=0 for s,j in zip(sgn,a[i]): res+=s*j S[i]=res mx,mn=max(S),min(S) for i in range(n): ans[i]=max(ans[i],mx-S[i],S[i]-mn) print(*ans,sep='\n')