#define PROB Training #include #include #include #include typedef std::pair PII; #define f(x,y,z) for(int x = (y),__ = (z);x < __;++x) #define g(x,y,z) for(int x = (y),__ = (z);x <= __;++x) #define gd(x,y,z) for(int x = (y),__ = (z);x >= __;--x) #define CLR(X) memset(X,0,sizeof(X)) #define SET(ARR,X) memset(ARR,X,sizeof(ARR)) #define R(X,Y) f(X,0,Y) #define G(x,y) g(X,0,Y) #define MAXN 1033 #ifdef WIN32 #define LLD "%I64d" #define LLU "%I64u" #else #define LLD "%lld" #define LLU "%llu" #endif typedef long long LL; typedef long double real; int n,m,k,q; int x,y; int a,b,c,d; int sx[100033],sy[100033]; int t; int main(){ scanf("%d",&t); while (t--){ memset(sx,0,sizeof sx); memset(sy,0,sizeof sy); scanf("%d%d%d%d",&n,&m,&k,&q); f(i,0,k){ scanf("%d%d",&x,&y); sx[x] = 1;sy[y] = 1; } g(i,1,n)sx[i] += sx[i - 1]; g(i,1,m)sy[i] += sy[i - 1]; f(i,0,q){ scanf("%d%d%d%d",&a,&b,&c,&d); if (sx[c] == sx[a - 1] + c - a + 1 || sy[d] == sy[b - 1] + d - b + 1){ puts("Yes"); }else puts("No"); } } return 0; }