func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   int n, m, k, fa[N], cnt[N], vis[N];   vector<int> G[N];   vector<pair<int, int> > p, q[N];   int findset(int x) { return x == fa[x] ? x : fa[x] = findset(fa[x]); }   void dfs(int x) {     vis[x] = 1;     for (auto it : G[x]) dfs(it);     for (auto it : q[x])       if (vis[it.first]) cnt[it.second]++;     vis[x] = 0;   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 0; i <= n; i++) fa[i] = i;     int opt, x, y;     while (m--) {       scanf( %d %d , &opt, &x);       if (opt == 1)         scanf( %d , &y), fa[x] = y, G[y].push_back(x);       else if (opt == 2)         p.push_back({findset(x), x});       else {         scanf( %d , &y);         q[x].push_back({p[y - 1].first, k});         q[p[y - 1].second].push_back({x, k});         k++;       }     }     for (int i = 1; i <= n; i++)       if (fa[i] == i) dfs(i);     for (int i = 0; i < k; i++) printf( %s n , cnt[i] == 2 ?  YES  :  NO );     return 0;   }   