func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 7;   struct node {     int l, r, id;   } p[2][2][maxn];   bool cmp1(node A, node B) { return A.l < B.l; }   bool cmp2(node A, node B) { return A.r < B.r; }   int n;   int sz[2][maxn];   int rid1[maxn], rid2[maxn];   int main() {     srand(time(NULL));     memset(sz, 0, sizeof(sz));     scanf( %d , &n);     for (int i = 0; i < n; i++) {       for (int j = 0; j < 2; j++) {         scanf( %d%d , &p[j][0][i].l, &p[j][0][i].r);         p[j][0][i].id = i;         p[j][1][i] = p[j][0][i];       }     }     for (int i = 0; i < 10000000; i++) {       int l = rand() % n;       int r = rand() % n;       int L11 = p[0][0][l].l, L12 = p[0][0][l].r;       int L21 = p[1][0][l].l, L22 = p[1][0][l].r;       int R11 = p[0][0][r].l, R12 = p[0][0][r].r;       int R21 = p[1][0][r].l, R22 = p[1][0][r].r;       int flag1 = 0, flag2 = 0;       if (max(L11, R11) <= min(L12, R12)) {         flag1 = 1;       } else {         flag1 = 0;       }       if (max(L21, R21) <= min(L22, R22)) {         flag2 = 1;       } else {         flag2 = 0;       }       if (flag1 != flag2) {         cout <<  NO  << endl;         return 0;       }     }     for (int i = 0; i < 2; i++) {       sort(p[i][0], p[i][0] + n, cmp1);       sort(p[i][1], p[i][1] + n, cmp2);     }     for (int j = 0; j < 2; j++) {       for (int i = 0; i < n; i++) {         int l = 0, r = n - 1, ans = n;         while (l <= r) {           int mid = (l + r) / 2;           if (p[j][0][mid].l > p[j][0][i].r) {             r = mid - 1;             ans = mid;           } else {             l = mid + 1;           }         }         sz[j][p[j][0][i].id] += n - ans;         l = 0, r = n - 1, ans = -1;         while (l <= r) {           int mid = (l + r) / 2;           if (p[j][1][mid].r < p[j][0][i].l) {             l = mid + 1;             ans = mid;           } else {             r = mid - 1;           }         }         sz[j][p[j][0][i].id] += ans + 1;       }     }     for (int i = 0; i < n; i++) {       if (sz[0][i] != sz[1][i]) {         cout <<  NO  << endl;         return 0;       }     }     cout <<  YES  << endl;   }   