func_code_string: #include <bits/stdc++.h>   using namespace std;   bool cycle[3001];   int vis[3001];   vector<vector<int> > adj;   bool f;   int node;   bool getC(int ind, int prev) {     if (cycle[ind]) {       node = ind;       return 1;     }     cycle[ind] = 1;     for (int i = 0; i < (int)adj[ind].size(); i++)       if (prev != adj[ind][i] && getC(adj[ind][i], ind)) {         if (!f)           cycle[ind] = 0;         else           vis[ind] = 0;         if (ind == node) f = 0;         return 1;       }     cycle[ind] = 0;     return 0;   }   void dfs(int ind, int l) {     vis[ind] = l;     for (int i = 0; i < (int)adj[ind].size(); i++) {       if (vis[adj[ind][i]] == -1) dfs(adj[ind][i], l + 1);     }   }   int main() {     memset(vis, -1, sizeof vis);     int n;     f = 1;     scanf( %d , &n);     adj = vector<vector<int> >(n + 1);     int a, b;     for (int i = 0; i < (int)n; i++) {       scanf( %d%d , &a, &b);       adj[a].push_back(b);       adj[b].push_back(a);     }     getC(1, -1);     for (int i = 1; i <= n; i++)       if (cycle[i]) {         dfs(i, 0);       }     for (int i = 1; i <= n; i++) cout << vis[i] <<    ;     cout << endl;     return 0;   }   