func_code_string: #include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) {     if (b == 0)       return a;     else       return gcd(b, a % b);   }   const int maxn = 5e4 + 9;   int p[1009], a[1009];   bool vis[1009];   int dfs(int i) {     if (vis[i]) return i;     vis[i] = 1;     int id = dfs(p[i]);     return id;   }   int main() {     int n;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> p[i];     }     for (int i = 1; i <= n; i++) {       memset(vis, 0, sizeof(vis));       a[i] = dfs(i);     }     for (int i = 1; i <= n; i++) {       cout << a[i] <<    ;     }     cout << endl;     return 0;   }   