func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 10;   int vis[maxn], son[maxn], f[maxn], sum, root, ans[maxn];   vector<int> g[maxn];   void getroot(int x, int fa) {     son[x] = 1;     f[x] = 0;     for (int i = 0; i < g[x].size(); i++) {       int v = g[x][i];       if (v == fa || vis[v]) continue;       getroot(v, x);       son[x] += son[v];       f[x] = max(f[x], son[v]);     }     f[x] = max(f[x], sum - son[x]);     if (f[x] < f[root]) root = x;   }   void work(int x, int fa, int dep) {     ans[x] = dep;     vis[x] = 1;     for (int i = 0; i < g[x].size(); i++) {       int v = g[x][i];       if (vis[v]) continue;       sum = son[v], root = 0;       getroot(v, x);       work(root, x, dep + 1);     }   }   int main(void) {     int n;     while (~scanf( %d , &n) && n) {       for (int i = 1; i <= n; i++) g[i].clear();       int a, b;       for (int i = 0; i < n - 1; i++) {         scanf( %d %d , &a, &b);         g[a].push_back(b);         g[b].push_back(a);       }       f[0] = sum = n;       getroot(1, 0);       work(root, 0, 0);       for (int i = 1; i <= n; i++) {         printf( %c  , ans[i] +  A );       }       printf(  n );     }     return 0;   }   