n = int(input()) p = [list(map(int,input().split())) for _ in range(n)] ans = [0]*n for s in range(16): q = [] for pi in p: q.append(pi[4]) for i in range(4): if s>>i&1: q[-1] += pi[i] else: q[-1] -= pi[i] ma = max(q); mi = min(q) for i,v in enumerate(q): ans[i] = max(ans[i],ma-v,v-mi) print(*ans,sep="\n")