func_code_string: #include <bits/stdc++.h>   std::vector<int> ReadVector(size_t size) {     std::vector<int> vector(size);     for (auto& element : vector) {       std::cin >> element;     }     return vector;   }   bool is_pal(const std::string& a) {     for (size_t i = 0; i < a.size() / 2; ++i) {       if (a[i] != a[a.size() - i - 1]) {         return false;       }     }     return true;   }   class Solver {    public:     std::vector<std::vector<int>> g;     Solver() {}     void read() {}     void solve() {       size_t n;       std::cin >> n;       g.resize(n);       for (size_t i = 0; i < n - 1; ++i) {         int a, b;         std::cin >> a >> b;         a--;         b--;         g[a].push_back(b);         g[b].push_back(a);       }       int root = -1;       int begin = -1;       int end = -1;       for (int v = 0; v < n; ++v) {         if (g[v].size() > 2) {           if (root != -1) {             std::cout <<  No  << std::endl;             return;           } else {             root = v;           }         }         if (g[v].size() == 1) {           if (begin == -1) {             begin = v;           } else {             end = v;           }         }       }       std::cout <<  Yes n ;       if (root == -1) {         std::cout << 1 << std::endl;         std::cout << begin + 1 <<     << end + 1 << std::endl;         return;       }       std::cout << g[root].size() << std::endl;       for (auto ch : g[root]) {         std::cout << root + 1 <<    ;         int tmp = ch;         int parent = root;         while (g[tmp].size() == 2) {           if (g[tmp][0] == parent) {             parent = tmp;             tmp = g[tmp][1];           } else {             parent = tmp;             tmp = g[tmp][0];           }         }         std::cout << tmp + 1 << std::endl;       }     }   };   int main() {     std::ios_base::sync_with_stdio(false);     std::cin.tie(nullptr);     Solver solver;     solver.solve();     return 0;   }   