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): M=-X m=X for i in range(n): M=max(M,f(i,k)) m=min(m,f(i,k)) for i in range(n): ans[i]=max(ans[i],M-f(i,k)) ans[i]=max(ans[i],f(i,k)-m) print(*ans,sep="\n")