import java.io.*; import java.util.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int[] xlow = new int[n]; int[] ylow = new int[n]; int[] xhigh = new int[n]; int[] yhigh = new int[n]; TreeMap xCompress = new TreeMap<>(); TreeMap yCompress = new TreeMap<>(); for (int i = 0; i < n; i++) { xlow[i] = sc.nextInt(); xCompress.put(xlow[i], null); ylow[i] = sc.nextInt(); yCompress.put(ylow[i], null); xhigh[i] = sc.nextInt(); xCompress.put(xhigh[i], null); yhigh[i] = sc.nextInt(); yCompress.put(yhigh[i], null); } int xsize = xCompress.size(); int[] xValue = new int[xsize + 1]; int idx = 0; int prev = -1; for (int x : xCompress.keySet()) { xCompress.put(x, idx); if (idx > 0) { xValue[idx - 1] = x - prev; } prev = x; idx++; } int ysize = yCompress.size(); int[] yValue = new int[ysize + 1]; idx = 0; prev = -1; for (int x : yCompress.keySet()) { yCompress.put(x, idx); if (idx > 0) { yValue[idx - 1] = x - prev; } prev = x; idx++; } boolean[][] field = new boolean[xsize + 1][ysize + 1]; StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { int ans = 0; for (int x = xCompress.get(xlow[i]); x < xCompress.get(xhigh[i]); x++) { for (int y = yCompress.get(ylow[i]); y < yCompress.get(yhigh[i]); y++) { if (!field[x][y]) { ans += xValue[x] * yValue[y]; field[x][y] = true; } } } sb.append(ans).append("\n"); } System.out.print(sb); } } class Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }