import java.util.*;import java.io.*;import java.math.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int Q = sc.nextInt(); for(int i = 0; i < Q; i++){ int xL = sc.nextInt(); int xH = sc.nextInt(); int yL = sc.nextInt(); int yH = sc.nextInt(); System.out.println("SELECT count(*) FROM point WHERE x BETWEEN " + xL + " AND " + xH + " AND y BETWEEN " + yL + " AND " + yH + ";"); } } }