n=int(input()) p=[list(map(int,input().split())) for i in range(n)] X=10**20 ans=[-X]*n f=lambda i,k:sum(p[i][j]*(1-2*((k>>j)&1)) for j in range(5)) for k in range(1<<5): q=[f(i,k) for i in range(n)] M=max(q) m=min(q) for i in range(n): ans[i]=max(ans[i],M-q[i]) ans[i]=max(ans[i],q[i]-m) print(*ans,sep="\n")