import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); long[][] a = new long[n][5]; for (int i = 0; i < n; i++) { String[] sa = br.readLine().split(" "); for (int j = 0; j < 5; j++) { a[i][j] = Long.parseLong(sa[j]); } } br.close(); long[] min = new long[32]; long[] max = new long[32]; Arrays.fill(min, Long.MAX_VALUE); Arrays.fill(max, Long.MIN_VALUE); for (int i = 0; i < n; i++) { for (int k = 0; k < 32; k++) { long v = 0; for (int j = 0; j < 5; j++) { if ((k >> j & 1) == 1) { v += a[i][j]; } else { v -= a[i][j]; } } min[k] = Math.min(min[k], v); max[k] = Math.max(max[k], v); } } PrintWriter pw = new PrintWriter(System.out); for (int i = 0; i < n; i++) { long ans = 0; for (int k = 0; k < 32; k++) { long v = 0; for (int j = 0; j < 5; j++) { if ((k >> j & 1) == 1) { v += a[i][j]; } else { v -= a[i][j]; } } ans = Math.max(ans, v - min[k]); ans = Math.max(ans, max[k] - v); } pw.println(ans); } pw.flush(); } }