func_code_string: #include <bits/stdc++.h>   using namespace std;   const int NMAX = 1000000;   vector<int> graf[1 + NMAX];   int minim[1 + NMAX];   int minimLant = INT_MAX;   bool vizitat[1 + NMAX];   void dfs(int z) {     for (int i = 0; i < graf[z].size(); i++) {       if (!vizitat[graf[z][i]]) {         vizitat[graf[z][i]] = true;         minim[graf[z][i]] = min(minim[z], graf[z][i]);         dfs(graf[z][i]);       }     }   }   int main() {     int n, q;     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cin >> n >> q;     for (int i = 1; i <= n - 1; i++) {       int x, y;       cin >> x >> y;       graf[x].emplace_back(y);       graf[y].emplace_back(x);     }     for (int i = 1; i <= n; i++) {       minim[i] = INT_MAX;     }     int t, z;     cin >> t >> z;     z = z % n + 1;     minim[z] = z;     vizitat[z] = true;     dfs(z);     int last = 0;     for (int i = 2; i <= q; i++) {       cin >> t >> z;       z = (z + last) % n + 1;       if (t == 1) {         minimLant = min(minimLant, minim[z]);       } else {         last = min(minimLant, minim[z]);         cout << last <<   n ;       }     }     return 0;   }   