func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<int> adj[3003];   int cost[3003], par[3003];   bool vis[3003];   map<pair<int, int>, bool> mark;   void path(int x, int y) {     if (x == y) return;     cost[x] = 0;     path(par[x], y);   }   void dfs(int u) {     vis[u] = true;     for (int v : adj[u]) {       if (vis[v]) {         if (par[u] != v) {           cost[v] = 0;           if (!mark[{u, v}]) {             path(u, v);             mark[{u, v}] = mark[{v, u}] = true;           }         }       } else         par[v] = u, dfs(v);     }   }   void bfs(int src) {     queue<int> q;     q.push(src);     while (q.size()) {       int u = q.front();       q.pop();       for (int v : adj[u]) {         if (cost[v] == -1) {           cost[v] = cost[u] + 1;           q.push(v);         }       }     }   }   int main() {     int n, x, y;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> x >> y;       adj[x].push_back(y);       adj[y].push_back(x);     }     memset(cost, -1, sizeof cost);     par[1] = 1;     dfs(1);     memset(vis, false, sizeof vis);     for (int i = 1; i <= n; i++) {       if (cost[i] == 0) bfs(i);     }     for (int i = 1; i <= n; i++) cout << cost[i] <<    ;   }   