func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 100005;   vector<vector<long long> > adj(N), w(N);   long long out[N], col[N], res[N], cnt;   queue<long long> q;   void dfs(long long v, long long p) {     for (auto &u : adj[v]) {       if (u == p) continue;       dfs(u, v);     }     for (auto &u : adj[v]) {       if (u == p) continue;       if (col[u] != col[v] && !res[u] && !res[v]) {         res[u] = res[v] = ++cnt;         q.push(v);         q.push(u);       }     }     return;   }   void bfs() {     q.push(1);     col[1] = 1;     while (!q.empty()) {       long long v = q.front();       q.pop();       for (auto &u : adj[v]) {         if (!col[u]) {           col[u] = col[v] % 2 + 1;           q.push(u);         }       }     }     cnt = 0;     dfs(1, 0);     while (!q.empty()) {       long long v = q.front();       q.pop();       for (auto &u : adj[v]) {         if (!res[u]) {           res[u] = res[v];           q.push(u);         }       }     }     return;   }   int main() {     long long n, i, j, v, u, ans;     cin >> n;     for (i = 0; i < n - 1; i++) {       cin >> v >> u;       adj[v].push_back(u);       adj[u].push_back(v);     }     bfs();     for (i = 1; i <= n; i++) w[res[i]].push_back(i);     ans = 0;     for (i = 1; i <= cnt; i++) {       ans += (w[i].size() - 1) * 2;       for (j = 0; j < w[i].size(); j++)         out[w[i][j]] = w[i][(j + 1) % w[i].size()];     }     cout << ans <<   n ;     for (i = 1; i <= n; i++) cout << out[i] <<    ;     return 0;   }   