func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2e5;   vector<int> graph[N];   int pa[N];   int getHeight(int u, int pre) {     int res = 1;     pa[u] = pre;     for (auto e : graph[u]) {       if (e == pre) {         continue;       }       int subHeight = getHeight(e, u);       res = max(res, subHeight + 1);     }     return res;   }   bool checkBanalance(int u, int pre, int &height) {     if (graph[u].size() == 1) {       height = 0;       return true;     }     int h[2];     int idx = 0;     for (auto e : graph[u]) {       if (e == pre) {         continue;       }       bool ret = checkBanalance(e, u, h[idx++]);       if (!ret) {         return false;       }     }     height = h[0] + 1;     if (h[0] != h[1]) {       return false;     }     return true;   }   int d[N];   int maxDepth = 0;   int maxNode = 0;   int getDepth(int u, int pre) {     d[u] = d[pre] + 1;     pa[u] = pre;     for (auto e : graph[u]) {       if (e == pre) {         continue;       }       getDepth(e, u);     }     if (d[u] > maxDepth) {       maxDepth = d[u];       maxNode = u;     }     return d[u];   }   int main() {     int n;     scanf( %d , &n);     int nodeErase = (1 << n) - 1;     int u, v;     for (int i = 1; i <= (1 << n) - 3; i++) {       scanf( %d%d , &u, &v);       graph[u].push_back(v);       graph[v].push_back(u);     }     if (n == 2) {       printf( 2 n );       printf( 1 2 n );       return 0;     }     vector<int> cnt[5];     int res;     int root;     for (int i = 1; i <= (1 << n) - 2; i++) {       int degree = graph[i].size();       if (degree > 4 || degree < 1) {         do {           printf( 0 n );           return 0;         } while (0);         ;       }       cnt[degree].push_back(i);     }     if (cnt[4].size() > 1 || cnt[2].size() > 2) {       do {         printf( 0 n );         return 0;       } while (0);       ;     } else if (cnt[4].size() == 1) {       if (cnt[2].size() != 1) {         do {           printf( 0 n );           return 0;         } while (0);         ;       }       root = cnt[2][0];       res = cnt[4][0];       getHeight(root, 0);       pair<int, int> h[4];       int idx = 0;       for (auto e : graph[res]) {         if (e == pa[res]) {           continue;         }         h[idx++] = make_pair(getHeight(e, res), e);       }       sort(h, h + 3);       if (!(h[0].first == h[1].first && h[2].first == h[1].first + 1)) {         do {           printf( 0 n );           return 0;         } while (0);         ;       }       graph[h[0].second].push_back(nodeErase);       graph[h[1].second].push_back(nodeErase);       graph[res].push_back(nodeErase);       graph[nodeErase].push_back(h[0].second);       graph[nodeErase].push_back(h[1].second);       graph[nodeErase].push_back(res);       graph[res].erase(find(graph[res].begin(), graph[res].end(), h[0].second));       graph[res].erase(find(graph[res].begin(), graph[res].end(), h[1].second));       graph[h[0].second].erase(           find(graph[h[0].second].begin(), graph[h[0].second].end(), res));       graph[h[1].second].erase(           find(graph[h[1].second].begin(), graph[h[1].second].end(), res));     } else if (cnt[4].size() == 0 && cnt[2].size() == 2) {       for (int i = 0; i < 2; i++) {         root = cnt[2][i];         res = cnt[2][1 - i];         int h1 = getHeight(graph[root][0], 0);         int h2 = getHeight(graph[root][1], 0);         if (h1 == h2) {           break;         }       }       graph[res].push_back(nodeErase);       graph[nodeErase].push_back(res);     } else if (cnt[4].size() == 0 && cnt[2].size() == 0) {       u = cnt[1][0];       getDepth(u, 0);       int t = (maxDepth - 1) / 2;       v = maxNode;       for (int i = 0; i < t; i++) {         v = pa[v];       }       u = pa[v];       int height = 0;       if (checkBanalance(u, v, height) && checkBanalance(v, u, height)) {         if (u > v) {           swap(u, v);         }         printf( 2 n%d %d n , u, v);         return 0;       } else {         do {           printf( 0 n );           return 0;         } while (0);         ;       }     } else {       do {         printf( 0 n );         return 0;       } while (0);       ;     }     int height = 0;     bool ret = checkBanalance(root, 0, height);     if (ret) {       printf( 1 n%d n , res);     } else {       do {         printf( 0 n );         return 0;       } while (0);       ;     }     return 0;   }   