// Conturbatio.cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define LL long long #define lson l, m, rt<<1 #define rson m+1, r, rt<<1|1 #define PI 3.1415926535897932626 #define EXIT exit(0); #define PAUSE system("pause"); #define DEBUG puts("Here is a BUG"); #define SYNC_CLOSE ios::sync_with_stdio(false); #define what_is(x) cout << #x << " is " << x << endl; #define CLEAR(name, init) memset(name, init, sizeof(name)); const double eps = 1e-8; const int MAXN = (int)1e5 + 5; using namespace std; int row[MAXN], col[MAXN]; int main(int argc, char const *argv[]) { #ifndef ONLINE_JUDGE freopen("D:\\Documents\\Disk_Synchronous\\Programs\\Acm\\input.txt", "r", stdin); #endif int T; cin >> T; while(T--) { int n, m, k, q; cin >> n >> m >> k >> q; CLEAR(row, 0); CLEAR(col, 0); for(int i = 0; i < k; i++) { int x, y; scanf("%d%d", &x, &y); row[x] = 1; col[y] = 1; } for(int i = 1; i < MAXN; i++) { row[i] += row[i-1]; col[i] += col[i-1]; } while(q--) { int x1, y1, x2, y2; scanf("%d%d%d%d", &x1, &y1, &x2, &y2); if (row[x2] - row[x1-1] == x2-x1+1 || col[y2] - col[y1-1] == y2-y1+1) puts("Yes"); else puts("No"); } } return 0; }