func_code_string: #include <bits/stdc++.h>   using namespace std;   int64_t n;   vector<int64_t> adj[100001];   int64_t ss[100001];   void dfs(int64_t no, int64_t par = -1) {     ss[no] = 1;     for (auto j : adj[no]) {       if (j == par) {         continue;       }       dfs(j, no);       ss[no] += ss[j];     }   }   vector<int64_t> ord;   int64_t dfs2(int64_t no, int64_t par = -1) {     for (auto j : adj[no]) {       if (j == par) {         continue;       }       if (ss[j] > n / 2) {         return dfs2(j, no);       }     }     return no;   }   int64_t ans = 0;   void dfs3(int64_t no, int64_t par = -1, int64_t levv = 0) {     ord.push_back(no);     ans += levv * 2;     for (auto j : adj[no]) {       if (j == par) {         continue;       }       dfs3(j, no, levv + 1);     }   }   int64_t ans2[100001];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> n;     for (int64_t i = 0; i < n - 1; i++) {       int64_t aa, bb;       cin >> aa >> bb;       aa--;       bb--;       adj[aa].push_back(bb);       adj[bb].push_back(aa);     }     dfs(0);     int64_t cen = dfs2(0);     dfs3(cen);     for (int64_t i = 0; i < n; i++) {       ord.push_back(ord[i]);     }     int64_t x = (n / 2);     cout << ans << endl;     for (int64_t i = 0; i < n; i++) {       ans2[ord[i]] = ord[i + x] + 1;     }     for (int64_t i = 0; i < n; i++) {       cout << ans2[i] <<    ;     }     cout << endl;     return 0;   }   