#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define MAX 200100 #define X first #define Y second using namespace std; typedef long long i64; typedef pair Pii; int x[MAX], y[MAX], p, q; bool query(int x1, int y1, int x2, int y2) { int lx = lower_bound(x, x + p, x1) - x; int rx = upper_bound(x, x + p, x2) - x; if (rx - lx == x2 - x1 + 1) return true; int ly = lower_bound(y, y + q, y1) - y; int ry = upper_bound(y, y + q, y2) - y; if (ry - ly == y2 - y1 + 1) return true; return false; } int main() { int t, n, m, k, s; scanf("%d", &t); while (t--) { scanf("%d%d%d%d", &n, &m, &k, &s); for (int i = 0; i < k; ++i) { scanf("%d%d", &x[i], &y[i]); } sort(x, x + k); p = unique(x, x + k) - x; sort(y, y + k); q = unique(y, y + k) - y; while (s--) { int x1, y1, x2, y2; scanf("%d%d%d%d", &x1, &y1, &x2, &y2); printf("%s\n", query(x1, y1, x2, y2) ? "Yes" : "No"); } } return 0; }