N=int(input()) for i in range(N): a,b,c,d=input().split() print("SELECT count(*) FROM point WHERE x>={0} AND x<={1} AND y>={2} AND y<={3};".format(a,b,c,d))