#!/usr/bin/ python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines Q = int(readline()) for _ in range(Q): a, b, c, d = map(int, readline().split()) print('SELECT count(*) FROM point WHERE {} <= x <= {} AND {} <= y <= {};'.format(a, b, c, d))