func_code_string: #include <bits/stdc++.h>   int n, q, maxn;   int a[200005];   std::vector<int> v[1901][105];   inline void merge(std::vector<int> &v1, std::vector<int> &v2) {     if (v1.size() < v2.size()) std::swap(v1, v2);     v1.insert(v1.end(), v2.begin(), v2.end());     v2.clear();   }   inline void assign(int i, int x, int y, int l, int r) {     static int vis[105] = {};     if ((i + 1) * maxn <= n) {       for (int j = 1; j <= 100; j++) {         for (int k : v[i][j]) vis[k] = j;         v[i][j].clear();         v[i][j].push_back(j);       }       for (int j = i * maxn; j < (i + 1) * maxn; j++) a[j] = vis[a[j]];     }     for (int j = l; j < r; j++)       if (a[j] == x) a[j] = y;   }   int main() {     scanf( %d , &n);     maxn = sqrt(n * log2(n)) + 1;     for (int i = 0; i < n; i++) scanf( %d , &a[i]);     for (int i = 0; (i + 1) * maxn <= n; i++)       for (int j = 1; j <= 100; j++) v[i][j].push_back(j);     for (scanf( %d , &q); q--;) {       int l, r, x, y, L, R;       scanf( %d%d%d%d , &l, &r, &x, &y);       if (x != y) {         l--;         L = l / maxn, R = r / maxn;         if (L != R) {           assign(L, x, y, l, (L + 1) * maxn);           for (int i = L + 1; i < R; i++) merge(v[i][y], v[i][x]);           assign(R, x, y, R * maxn, r);         } else           assign(L, x, y, l, r);       }     }     for (int i = 0; (i + 1) * maxn <= n; i++) assign(i, 0, 0, 0, 0);     for (int i = 0; i < n; i++) printf( %d  , a[i]);   }   