# -*- coding: utf-8 -*- N = int(input()) for n in range(N): Xl,Xh,Yl,Yh = input().split() print("SELECT count(*) FROM point WHERE",Xl + "<=x<=" + Xh,"AND",Yl + "<=y<=" + Yh,";",flush = True)