import sys n = int(input()) for _ in range(n): xl, xh, yl, yh = (int(z) for z in input().split()) print("SELECT count(*) FROM point WHERE x>={} AND x<={} AND y>={} AND y<={};".format(xl, xh, yl, yh)) sys.stdout.flush()