func_code_string: #include <bits/stdc++.h>   using namespace std;   void go(int parent, int node, int depth, int& odd_count, int& even_count,           vector<vector<int>>& tree) {     int count = 0;     for (int i = 0; i < tree[node].size(); i++) {       if (tree[node][i] != parent) {         count++;         go(node, tree[node][i], depth + 1, odd_count, even_count, tree);       }     }     if (count == 0) {       odd_count += depth % 2;       even_count += !(depth % 2);     }   }   int main() {     int n;     scanf( %d , &n);     vector<vector<int>> tree(n);     for (int i = 0; i < n - 1; i++) {       int u, v;       scanf( %d %d , &u, &v);       tree[u - 1].push_back(v - 1);       tree[v - 1].push_back(u - 1);     }     int root = -1;     for (int i = 0; i < tree.size(); i++) {       if (tree[i].size() > 1) {         root = i;         break;       }     }     int odd_count = 0, even_count = 0;     go(-1, root, 0, odd_count, even_count, tree);     int min_ans = 0, max_ans = n - 1;     if (!odd_count || !even_count) {       min_ans = 1;     } else {       min_ans = 3;     }     vector<int> parent_leaf_count(n, 0);     for (int i = 0; i < n; i++) {       if (tree[i].size() == 1) {         parent_leaf_count[tree[i][0]]++;       }     }     for (int i = 0; i < n; i++) {       if (parent_leaf_count[i]) {         max_ans -= (parent_leaf_count[i] - 1);       }     }     printf( %d %d n , min_ans, max_ans);     return 0;   }   