func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 5;   int vis[N], parent[N];   vector<int> v[N];   void dfs(int node) {     vis[node] = 1;     for (auto i : v[node]) {       if (!vis[i]) {         parent[i] = node;         dfs(i);       }     }   }   int res[N];   int main() {     int n, l, r, k = 0;     scanf( %d   , &n);     parent[n] = n;     for (int i = 1; i < n; ++i) {       parent[i] = i;       scanf( %d %d , &l, &r);       v[l].push_back(r);       v[r].push_back(l);       k = max(k, max((int)v[l].size(), (int)v[r].size()));     }     k += 1;     vector<int> col(k + 1);     parent[1] = 1;     dfs(1);     memset(vis, 0, sizeof(vis));     queue<int> q;     vis[1] = true;     q.push(1);     res[1] = 1;     col[1] = true;     while (!q.empty()) {       int node = q.front();       q.pop();       col[res[parent[node]]] = true;       col[res[node]] = true;       int j = 1, x = (int)col.size();       for (auto i : v[node]) {         if (!vis[i]) {           q.push(i);           while (j < x and col[j] == true) ++j;           res[i] = j;           col[j] = true;           vis[i] = 1;         }       }       for (auto i : v[node]) col[res[i]] = false;       col[res[node]] = false;     }     printf( %d n , k);     for (int i = 1; i <= n; ++i) printf( %d  , res[i]);     return 0;   }   