func_code_string: #include <bits/stdc++.h>   using namespace std;   using vi = vector<int>;   using vvi = vector<vi>;   int main() {     int N;     cin >> N;     vvi tree(N);     for (int i = 0; i < N - 1; ++i) {       int a, b;       cin >> a >> b;       a--;       b--;       tree[a].push_back(b);       tree[b].push_back(a);     }     int min = 0, max = 0;     vi min_v(N), max_v(N);     for (int i = 0; i < N; ++i) min_v[i] = max_v[i] = i;     vi degree(N);     queue<int> q;     for (int u = 0; u < N; ++u)       if ((degree[u] = tree[u].size()) == 1) q.push(u);     while (!q.empty()) {       int u = q.front();       q.pop();       int n = tree[u][0];       for (int v : tree[u])         if (degree[v] > 0) n = v;       if (min_v[u] == u) {         swap(min_v[u], min_v[n]);         min += 2;       }       if (degree[n] > 0) {         degree[u] = 0;         if (--degree[n] == 1) q.push(n);       }     }     cout << min << endl;     for (int u = 0; u < N; ++u) cout << min_v[u] + 1 <<    ;     cout << endl;   }   