func_code_string: #include <bits/stdc++.h>   using namespace std;   const int cmax = 223466;   int p[cmax];   set<int> s;   int n, q;   int find(int x) { return p[x] == x ? x : p[x] = find(p[x]); }   void merge(int x, int y) {     int xx = find(x);     int yy = find(y);     if (xx == yy) return;     if (rand() % 2) swap(xx, yy);     p[xx] = yy;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n >> q;     for (int i = 1; i <= n; i++) p[i] = i;     for (int i = 0; i < n; i++) s.insert(i);     s.insert(1 << 30);     for (int i = 0; i < q; i++) {       int t = 0, x = 0, y = 0;       cin >> t >> x >> y;       if (x > y) swap(x, y);       if (t == 1) {         merge(x, y);       } else if (t == 2) {         vector<int> v;         auto it = s.lower_bound(x);         while (it != s.end()) {           if (*it >= y) break;           v.push_back(*it);           it++;         }         for (int i = 0; i < v.size(); i++) s.erase(v[i]);         for (int i = 0; i < v.size(); i++) merge(v[i], v[i] + 1);       } else {         int xx = find(x);         int yy = find(y);         if (xx == yy)           cout <<  YES n ;         else           cout <<  NO n ;       }     }     return 0;   }   