func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, k, q;   int x[411111], y[411111], a[411111], b[411111], aa[411111], bb[411111];   int ans[411111];   int mi[2000222];   void init(int pos, int l, int r) {     mi[pos] = -1;     if (l == r) return;     init(pos + pos, l, (l + r) / 2);     init(pos + pos + 1, (l + r) / 2 + 1, r);   }   void mod(int pos, int l, int r, int x, int v) {     if (x < l || x > r) return;     if (l == r) {       mi[pos] = v;       return;     }     mod(pos + pos, l, (l + r) / 2, x, v);     mod(pos + pos + 1, (l + r) / 2 + 1, r, x, v);     mi[pos] = min(mi[pos + pos], mi[pos + pos + 1]);   }   int fin(int pos, int l, int r, int ll, int rr) {     ll = max(ll, l);     rr = min(rr, r);     if (ll > rr) return 1e9;     if (l == ll && r == rr) return mi[pos];     return min(fin(pos + pos, l, (l + r) / 2, ll, rr),                fin(pos + pos + 1, (l + r) / 2 + 1, r, ll, rr));   }   void solve() {     vector<pair<int, int> > ev;     for (int i = 0; i < k; i++) {       ev.push_back(make_pair(y[i], -(i + 1)));     }     for (int i = 0; i < q; i++) {       ev.push_back(make_pair(bb[i], i + 1));     }     sort(ev.begin(), ev.end());     init(1, 0, n - 1);     for (int i = 0; i < ev.size(); i++) {       int id = ev[i].second;       if (id < 0) {         id = (-id) - 1;         mod(1, 0, n - 1, x[id], y[id]);       } else {         id = id - 1;         if (fin(1, 0, n - 1, a[id], aa[id]) >= b[id]) ans[id] = 1;       }     }   }   int main() {     cin >> n >> m >> k >> q;     for (int i = 0; i < k; i++) {       scanf( %d%d , &x[i], &y[i]);       x[i]--;       y[i]--;     }     for (int i = 0; i < q; i++) {       scanf( %d%d%d%d , &a[i], &b[i], &aa[i], &bb[i]);       a[i]--;       b[i]--;       aa[i]--;       bb[i]--;       ans[i] = 0;     }     solve();     for (int i = 0; i < k; i++) swap(x[i], y[i]);     for (int i = 0; i < q; i++) {       swap(a[i], b[i]);       swap(aa[i], bb[i]);     }     swap(n, m);     solve();     for (int i = 0; i < q; i++)       if (ans[i])         puts( YES );       else         puts( NO );     return 0;   }   