def main(): import sys input = sys.stdin.read().split() idx = 0 N = int(input[idx]) idx += 1 points = [] for _ in range(N): A = list(map(int, input[idx:idx + 5])) idx += 5 points.append(A) # Generate coefficients for each mask coeffs = [] for m in range(32): cm = [] for k in range(5): if (m >> k) & 1: cm.append(1) else: cm.append(-1) coeffs.append(cm) # Precompute max and min for each mask max_vals = [-float('inf')] * 32 min_vals = [float('inf')] * 32 for m in range(32): cm = coeffs[m] current_max = -float('inf') current_min = float('inf') for p in points: feature = (p[0] * cm[0] + p[1] * cm[1] + p[2] * cm[2] + p[3] * cm[3] + p[4] * cm[4]) if feature > current_max: current_max = feature if feature < current_min: current_min = feature max_vals[m] = current_max min_vals[m] = current_min # Compute result for each point results = [] for p in points: max_dist = 0 for m in range(32): cm = coeffs[m] feature = (p[0] * cm[0] + p[1] * cm[1] + p[2] * cm[2] + p[3] * cm[3] + p[4] * cm[4]) candidate = max(max_vals[m] - feature, feature - min_vals[m]) if candidate > max_dist: max_dist = candidate results.append(max_dist) # Output results sys.stdout.write("\n".join(map(str, results)) + "\n") if __name__ == "__main__": main()