#include <bits/stdc++.h>

#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<ii> vii;

const int MX = (1 << 17) + 5;
int n, k, d[MX], p[MX], lvl[MX], pro[MX];
vi adj[MX], cd, res, gra[MX], g3, g1;
queue<int> q;

void dfs (int u, int par = -1) {
	if (adj[u].size() - (par != -1) == 3)
		g3.pb(u);
	if (adj[u].size() - (par != -1) == 1)
		g1.pb(u);

	pro[u] = lvl[u];
	for (int v : adj[u])
		if (v != par) {
			p[v] = u;
			lvl[v] = lvl[u] + 1;
			dfs(v, u);
			pro[u] = max(pro[u], pro[v]);
		}
}

bool mcDick (int u, int p, int lvl) {
	if (gra[u].size() - (p != -1) == 0)
		return lvl == k - 1;
	if (gra[u].size() - (p != -1) != 2)
		return 0;

	for (int v : gra[u])
		if (v != p && !mcDick(v, u, lvl + 1))
			return 0;

	return 1;
}

void solve (int r) {
	g1.clear(), g3.clear();
	lvl[r] = 0, p[r] = -1;
	dfs(r);

	if (g1.size() + g3.size() != 1) return;

	for (int i = 1; i <= n; i++)
		gra[i] = adj[i];

	if (g1.size()) {
		gra[g1.back()].pb(n + 1);
		gra[n + 1] = {g1.back()};

		if (mcDick(r, -1, 0))
			res.pb(g1.back());
	} else {
		int u = g3.back();
		vi aux;

		for (int v : adj[u])
			if (v != p[u] && pro[v] != pro[u])
				aux.pb(v);
		if (aux.size() != 2) return;

		gra[u].clear();
		for (int v : adj[u])
			if (v != aux[0] && v != aux[1])
				gra[u].pb(v);

		gra[u].pb(n + 1);
		gra[n + 1] = {u, aux[0], aux[1]};

		gra[aux[0]].clear();
		for (int v : adj[aux[0]])
			if (v != u)
				gra[aux[0]].pb(v);
		gra[aux[0]].pb(n + 1);

		gra[aux[1]].clear();
		for (int v : adj[aux[1]])
			if (v != u)
				gra[aux[1]].pb(v);
		gra[aux[1]].pb(n + 1);

		if (mcDick(r, -1, 0))
			res.pb(u);
	}
}

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);

	cin >> k;
	n = (1 << k) - 2;
	for (int i = 1; i < n; i++) {
		int a, b;
		cin >> a >> b;
		adj[a].pb(b);
		adj[b].pb(a);
	}

	memset(d, -1, sizeof(d));
	for (int i = 1; i <= n; i++)
		if (adj[i].size() == 1) {
			q.push(i);
			d[i] = 0;
		}

	int mx = 0;
	while (q.size()) {
		int u = q.front();
		q.pop();

		for (int v : adj[u])
			if (d[v] == -1) {
				q.push(v);
				d[v] = d[u] + 1;
				mx = d[v];
			}
	}

	if (cd.size() > 2) {
		cout << 0 << endl;
		return 0;
	}

	for (int i = 1; i <= n; i++)
		if (d[i] == mx)
			cd.pb(i);

	for (int x : cd)
		solve(x);

	cout << res.size() << endl;
	for (int x : res)
		cout << x << " ";
	cout << endl;

	return 0;
}


#include<bits/stdc++.h>
#define REP(i,s,t) for(int i=s;i<=t;i++)
using namespace std;
const int maxn=1<<18;
vector<int> vec[maxn],rec[maxn];
int n,cnt[20],siz[maxn];
void erase(vector<int> &vec,int val){
	vector<int> ret;
	for(int i:vec) if(i!=val) ret.push_back(i);
	vec=ret;
}
void dfs1(int u,int r,int d){
	cnt[d]++;
	for(int i:vec[u]) if(i!=r) dfs1(i,u,d+1);
}
bool chk(){
	memset(cnt,0,sizeof cnt);
	REP(i,1,(1<<n)-1) cnt[vec[i].size()]++;
	if(!(cnt[1]==(1<<n-1)&&cnt[2]==1&&!cnt[4])) return false;
	memset(cnt,0,sizeof cnt);
	REP(i,1,(1<<n)-1) if(vec[i].size()==2) dfs1(i,0,0);
	REP(i,0,n-1) if(cnt[i]!=(1<<i)) return false;
	return true;
}
void dfs2(int u,int r){
	siz[u]=1;
	for(int i:vec[u]) if(i!=r) dfs2(i,u),siz[u]+=siz[i],rec[u].push_back(siz[i]);
	if(r) rec[u].push_back((1<<n)-2-siz[u]);
}
void solve(int i,vector<int> &ans){
	REP(j,0,2) REP(k,j+1,2){
		int u=vec[i][j],v=vec[i][k];
		erase(vec[u],i);
		erase(vec[v],i);
		erase(vec[i],u);
		erase(vec[i],v);
		vec[(1<<n)-1].clear();
		vec[u].push_back((1<<n)-1);
		vec[(1<<n)-1].push_back(u);
		vec[v].push_back((1<<n)-1);
		vec[(1<<n)-1].push_back(v);
		vec[i].push_back((1<<n)-1);
		vec[(1<<n)-1].push_back(i);
		bool flg=chk();
		vec[u].pop_back();
		vec[v].pop_back();
		vec[i].pop_back();
		vec[u].push_back(i);
		vec[i].push_back(u);
		vec[v].push_back(i);
		vec[i].push_back(v);
		if(flg){ans.push_back(i); return;}
	}
}
int main(){
#ifdef LOCAL
	freopen("F.in","r",stdin);
#endif
	cin>>n;
	if(n==2){cout<<"2\n1 2"; return 0;}
	REP(i,1,(1<<n)-3){
		int a,b; cin>>a>>b;
		vec[a].push_back(b);
		vec[b].push_back(a);
	}
	REP(i,1,(1<<n)-2) if(vec[i].size()>4){cout<<0; return 0;}
	REP(i,1,(1<<n)-2) if(vec[i].size()==4){
		REP(j,0,3) REP(k,j+1,3){
			int u=vec[i][j],v=vec[i][k];
			erase(vec[u],i);
			erase(vec[v],i);
			erase(vec[i],u);
			erase(vec[i],v);
			vec[(1<<n)-1].clear();
			vec[u].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(u);
			vec[v].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(v);
			vec[i].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(i);
			if(chk()){cout<<1<<'\n'<<i; return 0;}
			vec[u].pop_back();
			vec[v].pop_back();
			vec[i].pop_back();
			vec[u].push_back(i);
			vec[i].push_back(u);
			vec[v].push_back(i);
			vec[i].push_back(v);
		}
		cout<<0; return 0;
	}
	int cnt=0;
	REP(i,1,(1<<n)-2) if(vec[i].size()==2) cnt++;
	if(cnt>2){cout<<0; return 0;}
	if(cnt==2){
		vector<int> ans;
		REP(i,1,(1<<n)-2) if(vec[i].size()==2){
			vec[(1<<n)-1].clear();
			vec[(1<<n)-1].push_back(i);
			vec[i].push_back((1<<n)-1);
			if(chk()) ans.push_back(i);
			vec[i].pop_back();
		}
		cout<<ans.size()<<'\n';
		for(int i:ans) cout<<i<<' ';
		return;
	}
	if(cnt==1){cout<<0; return 0;}
	dfs2(1,0);
	vector<int> ans;
	REP(i,1,(1<<n)-2) if(vec[i].size()==3){
		int p1=rec[i][0],p2=rec[i][1],p3=rec[i][2];
		if(p1<p2) swap(p1,p2);
		if(p1<p3) swap(p1,p3);
		if(p2<p3) swap(p2,p3);
		if(p1==(1<<n-1)-1&&p2==p3&&p2==(1<<n-2)-1)
			solve(i,ans);
	}
	cout<<ans.size()<<'\n';
	for(int i:ans) cout<<i<<' ';
	return 0;
}


#include<bits/stdc++.h>
#define REP(i,s,t) for(int i=s;i<=t;i++)
using namespace std;
const int maxn=1<<18;
vector<int> vec[maxn],rec[maxn];
int n,cnt[20],siz[maxn];
void erase(vector<int> &vec,int val){
	vector<int> ret;
	for(int i:vec) if(i!=val) ret.push_back(i);
	vec=ret;
}
void dfs1(int u,int r,int d){
	cnt[d]++;
	for(int i:vec[u]) if(i!=r) dfs1(i,u,d+1);
}
bool chk(){
	memset(cnt,0,sizeof cnt);
	REP(i,1,(1<<n)-1) cnt[vec[i].size()]++;
	if(!(cnt[1]==(1<<n-1)&&cnt[2]==1&&!cnt[4])) return false;
	memset(cnt,0,sizeof cnt);
	REP(i,1,(1<<n)-1) if(vec[i].size()==2) dfs1(i,0,0);
	REP(i,0,n-1) if(cnt[i]!=(1<<i)) return false;
	return true;
}
void dfs2(int u,int r){
	siz[u]=1;
	for(int i:vec[u]) if(i!=r) dfs2(i,u),siz[u]+=siz[i],rec[u].push_back(siz[i]);
	if(r) rec[u].push_back((1<<n)-2-siz[u]);
}
void solve(int i,vector<int> &ans){
	REP(j,0,2) REP(k,j+1,2){
		int u=vec[i][j],v=vec[i][k];
		erase(vec[u],i);
		erase(vec[v],i);
		erase(vec[i],u);
		erase(vec[i],v);
		vec[(1<<n)-1].clear();
		vec[u].push_back((1<<n)-1);
		vec[(1<<n)-1].push_back(u);
		vec[v].push_back((1<<n)-1);
		vec[(1<<n)-1].push_back(v);
		vec[i].push_back((1<<n)-1);
		vec[(1<<n)-1].push_back(i);
		bool flg=chk();
		vec[u].pop_back();
		vec[v].pop_back();
		vec[i].pop_back();
		vec[u].push_back(i);
		vec[i].push_back(u);
		vec[v].push_back(i);
		vec[i].push_back(v);
		if(flg){ans.push_back(i); return;}
	}
}
int main(){
#ifdef LOCAL
	freopen("F.in","r",stdin);
#endif
	cin>>n;
	if(n==2){cout<<"2\n1 2"; return 0;}
	REP(i,1,(1<<n)-3){
		int a,b; cin>>a>>b;
		vec[a].push_back(b);
		vec[b].push_back(a);
	}
	REP(i,1,(1<<n)-2) if(vec[i].size()>4){cout<<0; return 0;}
	REP(i,1,(1<<n)-2) if(vec[i].size()==4){
		REP(j,0,3) REP(k,j+1,3){
			int u=vec[i][j],v=vec[i][k];
			erase(vec[u],i);
			erase(vec[v],i);
			erase(vec[i],u);
			erase(vec[i],v);
			vec[(1<<n)-1].clear();
			vec[u].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(u);
			vec[v].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(v);
			vec[i].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(i);
			if(chk()){cout<<1<<'\n'<<i; return 0;}
			vec[u].pop_back();
			vec[v].pop_back();
			vec[i].pop_back();
			vec[u].push_back(i);
			vec[i].push_back(u);
			vec[v].push_back(i);
			vec[i].push_back(v);
		}
		cout<<0; return 0;
	}
	int cnt=0;
	REP(i,1,(1<<n)-2) if(vec[i].size()==2) cnt++;
	if(cnt>2){cout<<0; return 0;}
	if(cnt==2){
		vector<int> ans;
		REP(i,1,(1<<n)-2) if(vec[i].size()==2){
			vec[(1<<n)-1].clear();
			vec[(1<<n)-1].push_back(i);
			vec[i].push_back((1<<n)-1);
			if(chk()) ans.push_back(i);
			vec[i].pop_back();
		}
		cout<<ans.size()<<'\n';
		for(int i:ans) cout<<i<<' ';
	}
	if(cnt==1){cout<<0; return 0;}
	dfs2(1,0);
	vector<int> ans;
	REP(i,1,(1<<n)-2) if(vec[i].size()==3){
		int p1=rec[i][0],p2=rec[i][1],p3=rec[i][2];
		if(p1<p2) swap(p1,p2);
		if(p1<p3) swap(p1,p3);
		if(p2<p3) swap(p2,p3);
		if(p1==(1<<n-1)-1&&p2==p3&&p2==(1<<n-2)-1)
			solve(i,ans);
	}
	cout<<ans.size()<<'\n';
	for(int i:ans) cout<<i<<' ';
	return 0;
}


#include<bits/stdc++.h>
#define REP(i,s,t) for(int i=s;i<=t;i++)
using namespace std;
const int maxn=1<<18;
vector<int> vec[maxn],rec[maxn];
int n,cnt[maxn],siz[maxn];
void erase(vector<int> &vec,int val){
	vector<int> ret;
	for(int i:vec) if(i!=val) ret.push_back(i);
	vec=ret;
}
void dfs1(int u,int r,int d){
	cnt[d]++;
	for(int i:vec[u]) if(i!=r) dfs1(i,u,d+1);
}
bool chk(){
	memset(cnt,0,sizeof cnt);
	REP(i,1,(1<<n)-1) cnt[vec[i].size()]++;
	if(!(cnt[1]==(1<<n-1)&&cnt[2]==1&&!cnt[4])) return false;
	memset(cnt,0,sizeof cnt);
	REP(i,1,(1<<n)-1) if(vec[i].size()==2) dfs1(i,0,0);
	REP(i,0,n-1) if(cnt[i]!=(1<<i)) return false;
	return true;
}
void dfs2(int u,int r){
	siz[u]=1;
	for(int i:vec[u]) if(i!=r) dfs2(i,u),siz[u]+=siz[i],rec[u].push_back(siz[i]);
	if(r) rec[u].push_back((1<<n)-2-siz[u]);
}
void solve(int i,vector<int> &ans){
	int p[3];
	REP(j,0,2) p[j]=vec[i][j];
	REP(j,0,2) REP(k,j+1,2){
		int u=p[j],v=p[k];
		erase(vec[u],i);
		erase(vec[v],i);
		erase(vec[i],u);
		erase(vec[i],v);
		vec[(1<<n)-1].clear();
		vec[u].push_back((1<<n)-1);
		vec[(1<<n)-1].push_back(u);
		vec[v].push_back((1<<n)-1);
		vec[(1<<n)-1].push_back(v);
		vec[i].push_back((1<<n)-1);
		vec[(1<<n)-1].push_back(i);
		bool flg=chk();
		vec[u].pop_back();
		vec[v].pop_back();
		vec[i].pop_back();
		vec[u].push_back(i);
		vec[i].push_back(u);
		vec[v].push_back(i);
		vec[i].push_back(v);
		if(flg){ans.push_back(i); return;}
	}
}
int main(){
#ifdef LOCAL
	freopen("F.in","r",stdin);
#endif
	cin>>n;
	if(n==2){cout<<"2\n1 2"; return 0;}
	REP(i,1,(1<<n)-3){
		int a,b; cin>>a>>b;
		vec[a].push_back(b);
		vec[b].push_back(a);
	}
	REP(i,1,(1<<n)-2) if(vec[i].size()>4){cout<<0; return 0;}
	REP(i,1,(1<<n)-2) if(vec[i].size()==4){
		int p[4];
		REP(j,0,3) p[j]=vec[i][j];
		REP(j,0,3) REP(k,j+1,3){
			int u=p[j],v=p[k];
			erase(vec[u],i);
			erase(vec[v],i);
			erase(vec[i],u);
			erase(vec[i],v);
			vec[(1<<n)-1].clear();
			vec[u].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(u);
			vec[v].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(v);
			vec[i].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(i);
			if(chk()){cout<<1<<'\n'<<i; return 0;}
			vec[u].pop_back();
			vec[v].pop_back();
			vec[i].pop_back();
			vec[u].push_back(i);
			vec[i].push_back(u);
			vec[v].push_back(i);
			vec[i].push_back(v);
		}
		cout<<0; return 0;
	}
	int cnt=0;
	REP(i,1,(1<<n)-2) if(vec[i].size()==2) cnt++;
	if(cnt>2){cout<<0; return 0;}
	if(cnt==2){
		vector<int> ans;
		REP(i,1,(1<<n)-2) if(vec[i].size()==2){
			vec[(1<<n)-1].clear();
			vec[(1<<n)-1].push_back(i);
			vec[i].push_back((1<<n)-1);
			if(chk()) ans.push_back(i);
			vec[i].pop_back();
		}
		cout<<ans.size()<<'\n';
		for(int i:ans) cout<<i<<' ';
		return 0;
	}
	if(cnt==1){cout<<0; return 0;}
	dfs2(1,0);
	vector<int> ans;
	REP(i,1,(1<<n)-2) if(vec[i].size()==3){
		int p1=rec[i][0],p2=rec[i][1],p3=rec[i][2];
		if(p1<p2) swap(p1,p2);
		if(p1<p3) swap(p1,p3);
		if(p2<p3) swap(p2,p3);
		if(p1==(1<<n-1)-1&&p2==p3&&p2==(1<<n-2)-1)
			solve(i,ans);
	}
	cout<<ans.size()<<'\n';
	for(int i:ans) cout<<i<<' ';
	return 0;
}


#include<bits/stdc++.h>
#define REP(i,s,t) for(int i=s;i<=t;i++)
using namespace std;
const int maxn=1<<18;
vector<int> vec[maxn],rec[maxn];
int n,cnt[20],siz[maxn];
void erase(vector<int> &vec,int val){
	vector<int> ret;
	for(int i:vec) if(i!=val) ret.push_back(i);
	vec=ret;
}
void dfs1(int u,int r,int d){
	cnt[d]++;
	for(int i:vec[u]) if(i!=r) dfs1(i,u,d+1);
}
bool chk(){
	memset(cnt,0,sizeof cnt);
	REP(i,1,(1<<n)-1) cnt[vec[i].size()]++;
	if(!(cnt[1]==(1<<n-1)&&cnt[2]==1&&!cnt[4])) return false;
	memset(cnt,0,sizeof cnt);
	REP(i,1,(1<<n)-1) if(vec[i].size()==2) dfs1(i,0,0);
	REP(i,0,n-1) if(cnt[i]!=(1<<i)) return false;
	return true;
}
void dfs2(int u,int r){
	siz[u]=1;
	for(int i:vec[u]) if(i!=r) dfs2(i,u),siz[u]+=siz[i],rec[u].push_back(siz[i]);
	if(r) rec[u].push_back((1<<n)-2-siz[u]);
}
void solve(int i,vector<int> &ans){
	REP(j,0,2) REP(k,j+1,2){
		int u=vec[i][j],v=vec[i][k];
		erase(vec[u],i);
		erase(vec[v],i);
		erase(vec[i],u);
		erase(vec[i],v);
		vec[(1<<n)-1].clear();
		vec[u].push_back((1<<n)-1);
		vec[(1<<n)-1].push_back(u);
		vec[v].push_back((1<<n)-1);
		vec[(1<<n)-1].push_back(v);
		vec[i].push_back((1<<n)-1);
		vec[(1<<n)-1].push_back(i);
		bool flg=chk();
		vec[u].pop_back();
		vec[v].pop_back();
		vec[i].pop_back();
		vec[u].push_back(i);
		vec[i].push_back(u);
		vec[v].push_back(i);
		vec[i].push_back(v);
		if(flg){ans.push_back(i); return;}
	}
}
int main(){
#ifdef LOCAL
	freopen("F.in","r",stdin);
#endif
	cin>>n;
	if(n==2){cout<<"2\n1 2"; return 0;}
	REP(i,1,(1<<n)-3){
		int a,b; cin>>a>>b;
		vec[a].push_back(b);
		vec[b].push_back(a);
	}
	REP(i,1,(1<<n)-2) if(vec[i].size()>4){cout<<0; return 0;}
	REP(i,1,(1<<n)-2) if(vec[i].size()==4){
		REP(j,0,3) REP(k,j+1,3){
			int u=vec[i][j],v=vec[i][k];
			erase(vec[u],i);
			erase(vec[v],i);
			erase(vec[i],u);
			erase(vec[i],v);
			vec[(1<<n)-1].clear();
			vec[u].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(u);
			vec[v].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(v);
			vec[i].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(i);
			if(chk()){cout<<1<<'\n'<<i; return 0;}
			vec[u].pop_back();
			vec[v].pop_back();
			vec[i].pop_back();
			vec[u].push_back(i);
			vec[i].push_back(u);
			vec[v].push_back(i);
			vec[i].push_back(v);
		}
		cout<<0; return 0;
	}
	int cnt=0;
	REP(i,1,(1<<n)-2) if(vec[i].size()==2) cnt++;
	if(cnt>2){cout<<0; return 0;}
	if(cnt==2){
		vector<int> ans;
		REP(i,1,(1<<n)-2) if(vec[i].size()==2){
			vec[(1<<n)-1].clear();
			vec[(1<<n)-1].push_back(i);
			vec[i].push_back((1<<n)-1);
			if(chk()) ans.push_back(i);
			vec[i].pop_back();
		}
		cout<<ans.size()<<'\n';
		for(int i:ans) cout<<i<<' ';
		return 0;
	}
	if(cnt==1){cout<<0; return 0;}
	dfs2(1,0);
	vector<int> ans;
	REP(i,1,(1<<n)-2) if(vec[i].size()==3){
		int p1=rec[i][0],p2=rec[i][1],p3=rec[i][2];
		if(p1<p2) swap(p1,p2);
		if(p1<p3) swap(p1,p3);
		if(p2<p3) swap(p2,p3);
		if(p1==(1<<n-1)-1&&p2==p3&&p2==(1<<n-2)-1)
			solve(i,ans);
	}
	cout<<ans.size()<<'\n';
	for(int i:ans) cout<<i<<' ';
	return 0;
}


#include<bits/stdc++.h>
#define REP(i,s,t) for(int i=s;i<=t;i++)
using namespace std;
const int maxn=1<<18;
vector<int> vec[maxn];
int n,cnt[20];
void erase(vector<int> &vec,int val){
	vector<int> ret;
	for(int i:vec) if(i!=val) ret.push_back(i);
	vec=ret;
}
void dfs(int u,int r,int d){
	cnt[d]++;
	for(int i:vec[u]) if(i!=r) dfs(i,u,d+1);
}
bool chk(){
	memset(cnt,0,sizeof cnt);
	REP(i,1,(1<<n)-1) cnt[vec[i].size()]++;
	if(!(cnt[1]==(1<<n-1)&&cnt[2]==1&&!cnt[4])) return false;
	memset(cnt,0,sizeof cnt);
	REP(i,1,(1<<n)-1) if(vec[i].size()==2) dfs(i,0,0);
	REP(i,0,n-1) if(cnt[i]!=(1<<i)) return false;
	return true;
}
vector<int> ans;
int main(){
#ifdef LOCAL
	freopen("F.in","r",stdin);
#endif
	cin>>n;
	if(n==2){cout<<"2\n1 2"; return 0;}
	REP(i,1,(1<<n)-3){
		int a,b; cin>>a>>b;
		vec[a].push_back(b);
		vec[b].push_back(a);
	}
	REP(i,1,(1<<n)-2) if(vec[i].size()>4){cout<<0; return 0;}
	REP(i,1,(1<<n)-2) if(vec[i].size()==4){
		REP(j,0,3) REP(k,j+1,3){
			int u=vec[i][j],v=vec[i][k];
			erase(vec[u],i);
			erase(vec[v],i);
			erase(vec[i],u);
			erase(vec[i],v);
			vec[(1<<n)-1].clear();
			vec[u].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(u);
			vec[v].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(v);
			vec[i].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(i);
			if(chk()){cout<<1<<'\n'<<i; return 0;}
			vec[u].pop_back();
			vec[v].pop_back();
			vec[i].pop_back();
			vec[u].push_back(i);
			vec[i].push_back(u);
			vec[v].push_back(i);
			vec[i].push_back(v);
		}
		cout<<0; return 0;
	}
	REP(i,1,(1<<n)-2) if(vec[i].size()==2){
		vec[(1<<n)-1].clear();
		vec[(1<<n)-1].push_back(i);
		vec[i].push_back((1<<n)-1);
		if(chk()) ans.push_back(i);
		vec[i].pop_back();
	}
	cout<<ans.size()<<'\n';
	for(int i:ans) cout<<i<<' ';
	return 0;
}


#include<bits/stdc++.h>
#define REP(i,s,t) for(int i=s;i<=t;i++)
using namespace std;
const int maxn=1<<18;
vector<int> vec[maxn],rec[maxn];
int n,cnt[maxn],siz[maxn];
void erase(vector<int> &vec,int val){
	vector<int> ret;
	for(int i:vec) if(i!=val) ret.push_back(i);
	vec=ret;
}
void dfs1(int u,int r,int d){
	cnt[d]++;
	for(int i:vec[u]) if(i!=r) dfs1(i,u,d+1);
}
bool chk(){
	memset(cnt,0,sizeof cnt);
	REP(i,1,(1<<n)-1) cnt[vec[i].size()]++;
	if(!(cnt[1]==(1<<n-1)&&cnt[2]==1&&!cnt[4])) return false;
	memset(cnt,0,sizeof cnt);
	REP(i,1,(1<<n)-1) if(vec[i].size()==2) dfs1(i,0,0);
	REP(i,0,n-1) if(cnt[i]!=(1<<i)) return false;
	return true;
}
void dfs2(int u,int r){
	siz[u]=1;
	for(int i:vec[u]) if(i!=r) dfs2(i,u),siz[u]+=siz[i],rec[u].push_back(siz[i]);
	if(r) rec[u].push_back((1<<n)-2-siz[u]);
}
void solve(int i,vector<int> &ans){
	REP(j,0,2) REP(k,j+1,2){
		int u=vec[i][j],v=vec[i][k];
		erase(vec[u],i);
		erase(vec[v],i);
		erase(vec[i],u);
		erase(vec[i],v);
		vec[(1<<n)-1].clear();
		vec[u].push_back((1<<n)-1);
		vec[(1<<n)-1].push_back(u);
		vec[v].push_back((1<<n)-1);
		vec[(1<<n)-1].push_back(v);
		vec[i].push_back((1<<n)-1);
		vec[(1<<n)-1].push_back(i);
		bool flg=chk();
		vec[u].pop_back();
		vec[v].pop_back();
		vec[i].pop_back();
		vec[u].push_back(i);
		vec[i].push_back(u);
		vec[v].push_back(i);
		vec[i].push_back(v);
		if(flg){ans.push_back(i); return;}
	}
}
int main(){
#ifdef LOCAL
	freopen("F.in","r",stdin);
#endif
	cin>>n;
	if(n==2){cout<<"2\n1 2"; return 0;}
	REP(i,1,(1<<n)-3){
		int a,b; cin>>a>>b;
		vec[a].push_back(b);
		vec[b].push_back(a);
	}
	REP(i,1,(1<<n)-2) if(vec[i].size()>4){cout<<0; return 0;}
	REP(i,1,(1<<n)-2) if(vec[i].size()==4){
		REP(j,0,3) REP(k,j+1,3){
			int u=vec[i][j],v=vec[i][k];
			erase(vec[u],i);
			erase(vec[v],i);
			erase(vec[i],u);
			erase(vec[i],v);
			vec[(1<<n)-1].clear();
			vec[u].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(u);
			vec[v].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(v);
			vec[i].push_back((1<<n)-1);
			vec[(1<<n)-1].push_back(i);
			if(chk()){cout<<1<<'\n'<<i; return 0;}
			vec[u].pop_back();
			vec[v].pop_back();
			vec[i].pop_back();
			vec[u].push_back(i);
			vec[i].push_back(u);
			vec[v].push_back(i);
			vec[i].push_back(v);
		}
		cout<<0; return 0;
	}
	int cnt=0;
	REP(i,1,(1<<n)-2) if(vec[i].size()==2) cnt++;
	if(cnt>2){cout<<0; return 0;}
	if(cnt==2){
		vector<int> ans;
		REP(i,1,(1<<n)-2) if(vec[i].size()==2){
			vec[(1<<n)-1].clear();
			vec[(1<<n)-1].push_back(i);
			vec[i].push_back((1<<n)-1);
			if(chk()) ans.push_back(i);
			vec[i].pop_back();
		}
		cout<<ans.size()<<'\n';
		for(int i:ans) cout<<i<<' ';
		return 0;
	}
	if(cnt==1){cout<<0; return 0;}
	dfs2(1,0);
	vector<int> ans;
	REP(i,1,(1<<n)-2) if(vec[i].size()==3){
		int p1=rec[i][0],p2=rec[i][1],p3=rec[i][2];
		if(p1<p2) swap(p1,p2);
		if(p1<p3) swap(p1,p3);
		if(p2<p3) swap(p2,p3);
		if(p1==(1<<n-1)-1&&p2==p3&&p2==(1<<n-2)-1)
			solve(i,ans);
	}
	cout<<ans.size()<<'\n';
	for(int i:ans) cout<<i<<' ';
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long ll1;
const ll MAX=5e5+5;
ll MOD=1e9+7;
ll MOD1=1e9+9;
#define pb push_back
#define se second
#define fi first
#define sb __builtin_popcount
#define maxe max_element
#define mine min_element
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fbo find_by_order
#define ook order_of_key
#define up upper_bound
#define lb lower_bound
#define pq priority_queue
#define pll pair<ll,ll>
using namespace __gnu_pbds;
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define error 0.000000000000000001
ll add(ll a,ll b){if((ll1)a+b>=MOD)return (ll1)a+b-MOD;return a+b;}
ll mul(ll a,ll b){return ((ll1)a*b)%MOD;}
ll sub(ll a,ll b){if(a>=b)return a-b;return a-b+MOD;}
ll add1(ll a,ll b){return ((ll1)a+b)%MOD1;}
ll mul1(ll a,ll b){return ((ll1)a*b)%MOD1;}
#define boost               ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define dt pair<pll,ll>
vector<ll>possible;
ll n,dist=0;
vector<ll>v[MAX];
ll root,vertex;
ll pow1(ll a,ll b)
{
	if(!b)return 1;
	ll  x=pow1(a,b/2);
	x=mul(x,x);
	if(b&1)return mul(a,x);
	return x;
}
pll fun(pll a)
{
	ll x=1;
	ll ans=mul(a.fi,10);
	x+=a.se;
	ans=add(ans,mul(pow1(10,x),a.fi));
	x+=a.se;
	ans=add(ans,pow1(10,x));
	return {ans,x+1};
}
ll dfs(ll i,ll p)
{
	ll x=1,m=0;
	for(ll u:v[i]){
		if(u==p)continue;
		ll t=dfs(u,i);
		m=max(t,m);
		x+=t;
	}
	m=max(n-x,m);
	if(m<=n/2)possible.pb(i);
	return x;
}
pll dfs1(ll i,ll p)
{
	vector<pll>v1;
	ll  x=v[i].size();
	if(i!=root)x--;
	if(x==0)return {10,2};
	if(x>3){
		dist=2;
		return {0,0};
	}
	if(x==3 || x==1)dist++;
	for(ll u:v[i]){
		if(u==p)continue;
		v1.pb(dfs1(u,i));
	}
	if(x==1){
		if(v1[0].fi==10){
			vertex=i;
			return fun(v1[0]);
		}
		dist=2;
		return {0,0};
	}
	if(v1.size()==2){
		if(v1[0]!=v1[1]){
			dist=2;
			return {0,0};
		}
		return fun(v1[0]);
	}
	else{
		sort(v1.begin(),v1.end());
		pll ans=fun(v1[1]);
		vertex=i;
		if(v1[0].fi==v1[1].fi){
			if(ans.fi!=v1[2].fi){
				dist=2;
				return {0,0};
			}
			return fun(v1[2]);
		}
		else if(v1[1].fi==v1[2].fi){
			if(ans.fi!=v1[0].fi){
				dist=2;
				return {0,0};
			}
			return fun(v1[0]);
		}
		dist=2;
		return {0,0};
	}
}
int main()
{
	boost;
	//cout<<fixed<<setprecision(12);
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	cin>>n;
	n=(1<<n)-2;
	for(ll i=0;i<n-1;i++){
		ll a,b;
		cin>>a>>b;
		v[a].pb(b);
		v[b].pb(a);
	}
	dfs(1,-1);
	vector<ll>ans;
	for(ll u:possible){
		root=u;
		dist=0;
		dfs1(u,-1);
		if(dist<2)ans.pb(vertex);
	}
	if(ans.size()==2)
		if(ans[0]==ans[1])ans.pop_back();
	cout<<ans.size()<<'\n';
	sort(ans.begin(),ans.end());
	for(ll u:ans)cout<<u<<' ';
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long ll1;
const ll MAX=5e5+5;
ll MOD=1e9+7;
ll MOD1=1e9+9;
#define pb push_back
#define se second
#define fi first
#define sb __builtin_popcount
#define maxe max_element
#define mine min_element
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fbo find_by_order
#define ook order_of_key
#define up upper_bound
#define lb lower_bound
#define pq priority_queue
#define pll pair<ll,ll>
using namespace __gnu_pbds;
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define error 0.000000000000000001
ll add(ll a,ll b){if((ll1)a+b>=MOD)return (ll1)a+b-MOD;return a+b;}
ll mul(ll a,ll b){return ((ll1)a*b)%MOD;}
ll sub(ll a,ll b){if(a>=b)return a-b;return a-b+MOD;}
ll add1(ll a,ll b){return ((ll1)a+b)%MOD1;}
ll mul1(ll a,ll b){return ((ll1)a*b)%MOD1;}
#define boost               ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define dt pair<pll,ll>
vector<ll>possible;
ll n,dist=0;
vector<ll>v[MAX];
ll root,vertex;
ll pow1(ll a,ll b)
{
	if(!b)return 1;
	ll  x=pow1(a,b/2);
	x=mul(x,x);
	if(b&1)return mul(a,x);
	return x;
}
pll fun(pll a)
{
	ll x=1;
	ll ans=mul(a.fi,10);
	x+=a.se;
	ans=add(ans,mul(pow1(10,x),a.fi));
	x+=a.se;
	ans=add(ans,pow1(10,x));
	return {ans,x+1};
}
ll dfs(ll i,ll p)
{
	ll x=1,m=0;
	for(ll u:v[i]){
		if(u==p)continue;
		ll t=dfs(u,i);
		m=max(t,m);
		x+=t;
	}
	m=max(n-x,m);
	if(m<=n/2)possible.pb(i);
	return x;
}
pll dfs1(ll i,ll p)
{
	vector<pll>v1;
	ll  x=v[i].size();
	if(i!=root)x--;
	if(x==0)return {10,2};
	if(x>3){
		dist=2;
		return {0,0};
	}
	if(x==3 || x==1)dist++;
	for(ll u:v[i]){
		if(u==p)continue;
		v1.pb(dfs1(u,i));
	}
	if(x==1){
		if(v1[0].fi==10){
			vertex=i;
			return fun(v1[0]);
		}
		dist=2;
		return {0,0};
	}
	if(v1.size()==2){
		if(v1[0]!=v1[1]){
			dist=2;
			return {0,0};
		}
		return fun(v1[0]);
	}
	else{
		sort(v1.begin(),v1.end());
		pll ans=fun(v1[1]);
		vertex=i;
		if(v1[0].fi==v1[1].fi){
			if(ans.fi!=v1[2].fi){
				dist=2;
				return {0,0};
			}
			return fun(v1[2]);
		}
		else if(v1[1].fi==v1[2].fi){
			if(ans.fi!=v1[0].fi){
				dist=2;
				return {0,0};
			}
			return fun(v1[0]);
		}
		dist=2;
		return {0,0};
	}
}
int main()
{
	boost;
	//cout<<fixed<<setprecision(12);
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	cin>>n;
	n=(1<<n)-2;
	for(ll i=0;i<n-1;i++){
		ll a,b;
		cin>>a>>b;
		v[a].pb(b);
		v[b].pb(a);
	}
	dfs(1,-1);
	vector<ll>ans;
	for(ll u:possible){
		root=u;
		dist=0;
		dfs1(u,-1);
		if(dist<2)ans.pb(vertex);
	}
	cout<<ans.size()<<'\n';
	for(ll u:ans)cout<<u<<' ';
}


#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;

typedef long long lo;

template<typename tp> inline void read(tp &x) {
	x = 0; char c = getchar(); int f = 0;
	for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
	for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
	if (f) x = -x;
}

#define GG (puts("0"), exit(0))
const int N = 3e5 + 233;
vector <int> G[N], answer;
int n, s, dep[N], maxd[N];

struct TT {
	set <int> G[N];
	int valid;
	int dep[N];
	inline void link(int x, int y) {
		G[x].insert(y); G[y].insert(x);
	}
	inline void cut(int x, int y) {
		G[x].erase(y); G[y].erase(x);
	}
	inline void dfs(int u, int fat) {
		dep[u] = dep[fat] + 1;
		int son = 0;
		for (int v : G[u])
			if (v != fat) {
				dfs(v, u);
				++son;
			}
		if (son > 2) valid = false;
	}
	inline void doit(int u) {
		valid = true;
		int root = -1;
		rep (i, s) if (G[i].size() == 2) root = i;
		if (!~root) return ;
		dfs(root, 0);
		int md = *max_element(dep + 1, dep + s + 1);
		int cnt = 0;
		rep (i, s) cnt += dep[i] == md;
		if (cnt != s / 2 + 1 || !valid) return ;
		answer.push_back(u);
	}
} T;

int main(void) {
	read(n); s = (1 << n) - 1;
	rep (i, s - 2) {
		int x, y; read(x); read(y);
		G[x].push_back(y);
		G[y].push_back(x);
		T.link(x, y);
	}
	if (n == 2) {
		cout << "2\n1 2\n";
		return 0;
	}
	vector <int> t;
	rep (i, s) {
		if (G[i].size() == 2) {
			t.push_back(i);
		}
	}
	if (t.size() > 2) GG;
	if (t.size() == 2) {
		for (auto k : t) {
			auto S = T;
			S.link(k, s);
			S.doit(k);
		}
	} else {
		if (!t.size()) GG;
		int root = -1;
		function <void(int, int)> dfs = [&](int u, int fat) {
			maxd[u] = dep[u] = dep[fat] + 1;
			for (int v : G[u])
				if (v != fat) {
					dfs(v, u);
					maxd[u] = max(maxd[u], maxd[v]);
				}
			if (G[u].size() == 4) {
				if (root != -1) GG;
				root = u;
			}
		};
		dfs(t.front(), 0);
		int mx = 0;
		for (int v : G[root]) {
			if (dep[v] > dep[root]) {
				mx = max(mx, maxd[v]);
			}
		}
		for (int v : G[root]) {
			if (dep[v] > dep[root]) {
				if (maxd[v] != mx) {
					T.cut(root, v); T.link(root, s); T.link(s, v);
				}
			}
		}
		T.doit(root);
	}
	cout << answer.size() << "\n";
	for (int i : answer) cout << i << " " ; cout << "\n";
}


#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;

typedef long long lo;

template<typename tp> inline void read(tp &x) {
	x = 0; char c = getchar(); int f = 0;
	for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
	for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
	if (f) x = -x;
}

#define GG (puts("0"), exit(0))
const int N = 3e5 + 233;
vector <int> G[N], answer;
int n, s, dep[N], maxd[N];

struct TT {
	set <int> G[N];
	int valid;
	int dep[N];
	inline void link(int x, int y) {
		G[x].insert(y); G[y].insert(x);
	}
	inline void cut(int x, int y) {
		G[x].erase(y); G[y].erase(x);
	}
	inline void dfs(int u, int fat) {
		dep[u] = dep[fat] + 1;
		int son = 0;
		for (int v : G[u])
			if (v != fat) {
				dfs(v, u);
				++son;
			}
		if (son > 2) valid = false;
	}
	inline void doit(int u) {
		valid = true;
		int root = -1;
		rep (i, s) if (G[i].size() == 2) root = i;
		if (!~root) return ;
		dfs(root, 0);
		int md = *max_element(dep + 1, dep + s + 1);
		int cnt = 0;
		rep (i, s) cnt += dep[i] == md;
		if (cnt != s / 2 + 1 || !valid) return ;
		answer.push_back(u);
	}
} T;

int main(void) {
	read(n); s = (1 << n) - 1;
	rep (i, s - 2) {
		int x, y; read(x); read(y);
		G[x].push_back(y);
		G[y].push_back(x);
		T.link(x, y);
	}
	if (n == 2) {
		cout << "2\n1 2\n";
		return 0;
	}
	vector <int> t;
	rep (i, s) {
		if (G[i].size() == 2) {
			t.push_back(i);
		}
	}
	if (t.size() > 2) GG;
	if (t.size() == 2) {
		for (auto k : t) {
			auto S = T;
			S.link(k, s);
			S.doit(k);
		}
	} else {
		if (!t.size()) {
			vector <int> sz(s + 2, 0);
			function <void(int, int)> dfs = [&](int u, int fat) {
				sz[u] = 1;
				for (int v : G[u])
					if (v != fat) {
						dfs(v, u);
						sz[u] += sz[v];
					}
				if (sz[u] == s - 1 - sz[u]) {
					T.cut(u, fat);
					T.link(u, s);
					T.link(fat, s);
					T.doit(fat);
					T.doit(u);
				}
			};
			dfs(1, 0);
		} else {
		int root = -1;
		function <void(int, int)> dfs = [&](int u, int fat) {
			maxd[u] = dep[u] = dep[fat] + 1;
			for (int v : G[u])
				if (v != fat) {
					dfs(v, u);
					maxd[u] = max(maxd[u], maxd[v]);
				}
			if (G[u].size() == 4) {
				if (root != -1) GG;
				root = u;
			}
		};
		dfs(t.front(), 0);
		int mx = 0;
		for (int v : G[root]) {
			if (dep[v] > dep[root]) {
				mx = max(mx, maxd[v]);
			}
		}
		for (int v : G[root]) {
			if (dep[v] > dep[root]) {
				if (maxd[v] != mx) {
					T.cut(root, v); T.link(root, s); T.link(s, v);
				}
			}
		}
		T.doit(root);
		}
	}
	cout << answer.size() << "\n";
	for (int i : answer) cout << i << " " ; cout << "\n";
}


#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;

typedef long long lo;

template<typename tp> inline void read(tp &x) {
	x = 0; char c = getchar(); int f = 0;
	for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
	for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
	if (f) x = -x;
}

#define GG (puts("0"), exit(0))
const int N = 3e5 + 233;
vector <int> G[N], answer;
int n, s, dep[N], maxd[N];

struct TT {
	set <int> G[N];
	int valid;
	int dep[N];
	inline void link(int x, int y) {
		G[x].insert(y); G[y].insert(x);
	}
	inline void cut(int x, int y) {
		G[x].erase(y); G[y].erase(x);
	}
	inline void dfs(int u, int fat) {
		dep[u] = dep[fat] + 1;
		int son = 0;
		for (int v : G[u])
			if (v != fat) {
				dfs(v, u);
				++son;
			}
		if (son > 2) valid = false;
	}
	inline void doit(int u) {
		valid = true;
		int root = -1;
		rep (i, s) if (G[i].size() == 2) root = i;
		if (!~root) return ;
		dfs(root, 0);
		int md = *max_element(dep + 1, dep + s + 1);
		int cnt = 0;
		rep (i, s) cnt += dep[i] == md;
		if (cnt != s / 2 + 1 || !valid) return ;
		answer.push_back(u);
	}
} T;

int main(void) {
	read(n); s = (1 << n) - 1;
	rep (i, s - 2) {
		int x, y; read(x); read(y);
		G[x].push_back(y);
		G[y].push_back(x);
		T.link(x, y);
	}
	if (n == 2) {
		cout << "2\n1 2\n";
		return 0;
	}
	vector <int> t;
	rep (i, s) {
		if (G[i].size() == 2) {
			t.push_back(i);
		}
	}
	if (t.size() > 2) GG;
	if (t.size() == 2) {
		for (auto k : t) {
			auto S = T;
			S.link(k, s);
			S.doit(k);
		}
	} else {
		if (!t.size()) {
			vector <int> sz(s + 2, 0);
			function <void(int, int)> dfs = [&](int u, int fat) {
				sz[u] = 1;
				for (int v : G[u])
					if (v != fat) {
						dfs(v, u);
						sz[u] += sz[v];
					}
				if (sz[u] == s - 1 - sz[u]) {
					T.cut(u, fat);
					T.link(u, s);
					T.link(fat, s);
					T.doit(fat);
					T.doit(u);
				}
			};
			dfs(1, 0);
		} else {
		int root = -1;
		function <void(int, int)> dfs = [&](int u, int fat) {
			maxd[u] = dep[u] = dep[fat] + 1;
			for (int v : G[u])
				if (v != fat) {
					dfs(v, u);
					maxd[u] = max(maxd[u], maxd[v]);
				}
			if (G[u].size() == 4) {
				if (root != -1) GG;
				root = u;
			}
		};
		dfs(t.front(), 0);
		int mx = 0;
		for (int v : G[root]) {
			if (dep[v] > dep[root]) {
				mx = max(mx, maxd[v]);
			}
		}
		for (int v : G[root]) {
			if (dep[v] > dep[root]) {
				if (maxd[v] != mx) {
					T.cut(root, v); T.link(root, s); T.link(s, v);
				}
			}
		}
		T.doit(root);
		}
	}
	cout << answer.size() << "\n";
	sort(answer.begin(), answer.end());
	for (int i : answer) cout << i << " " ; cout << "\n";
}


#include<bits/stdc++.h>
using namespace std;
const int MAX_N=1<<17|5;
pair<int,int> h[MAX_N];
vector<int> son[MAX_N],ans;
bool cmp(int x,int y){ return h[x]<h[y]; }
void updata(int x,vector<int> a){
	int sum=0;
	for(int i=0;i<a.size();++i)
		if(h[a[i]].second>0){
			if(sum>0){
				h[x]=make_pair(-1,0);
				return;
			}
			sum+=h[a[i]].second;
		}
	if(a.size()==0){
		h[x]=make_pair(1,0);
	}else if(a.size()==1&&h[a[0]].first==1){
		h[x]=make_pair(2,x);
	}else if(a.size()==2&&h[a[0]].first==h[a[1]].first){
		h[x]=make_pair(h[a[0]].first+1,sum);
	}else if(a.size()==3&&h[a[0]].first==h[a[1]].first
				&&h[a[0]].first+1==h[a[2]].first&&sum==0){
		h[x]=make_pair(h[a[2]].first+1,x);
	}else h[x]=make_pair(-1,0);
}

void dfs1(int x,int pre){
	for(int i=0;i<son[x].size();++i){
		if(son[x][i]!=pre)
			dfs1(son[x][i],x);
	}
	sort(son[x].begin(),son[x].end(),cmp);
	vector<int> b=son[x];
	if(pre!=0) b.erase(find(b.begin(),b.end(),pre));
	updata(x,b);
}
void dfs2(int x,int pre){
	pair<int,int> rh=h[x];
	updata(x,son[x]);
	if(h[x].first!=-1)
		ans.push_back(h[x].second);
	for(int i=0;i<son[x].size();++i)
		if(son[x][i]!=pre){
			vector<int> b=son[x];
			b.erase(find(b.begin(),b.end(),son[x][i]));
			updata(x,b);
			dfs2(son[x][i],x);
		}
	h[x]=rh;
}
int main(){
	int n; scanf("%d",&n);
	for(int i=1;i<=(1<<n)-3;++i){
		int x,y; scanf("%d%d",&x,&y);
		son[x].push_back(y);
		son[y].push_back(x);
	}
	for(int i=0;i<=(1<<n)-2;++i)
		if(son[i].size()>4){
			puts("0");
			return 0;
		}
	dfs1(1,0);
	dfs2(1,0);
	sort(ans.begin(),ans.end());
	ans.erase(unique(ans.begin(),ans.end()),ans.end());
	printf("%d\n",(int)ans.size());
	for(auto x:ans) printf("%d ",x);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAX_N=1<<17|5;
pair<int,int> h[MAX_N];
vector<int> son[MAX_N],ans;
bool cmp(int x,int y){ return h[x]<h[y]; }
void updata(int x,vector<int> a){
	sort(a.begin(),a.end(),cmp);
	int sum=0;
	for(int i=0;i<a.size();++i){
		if(h[a[i]].first==-1){
			h[x]=make_pair(-1,0);
			return;
		}
		if(h[a[i]].second>0){
			if(sum>0){
				h[x]=make_pair(-1,0);
				return;
			}
			sum+=h[a[i]].second;
		}
	}
	if(a.size()==0){
		h[x]=make_pair(1,0);
	}else if(a.size()==1&&h[a[0]].first==1){
		h[x]=make_pair(2,x);
	}else if(a.size()==2&&h[a[0]].first==h[a[1]].first){
		h[x]=make_pair(h[a[0]].first+1,sum);
	}else if(a.size()==3&&h[a[0]].first==h[a[1]].first
				&&h[a[0]].first+1==h[a[2]].first&&sum==0){
		h[x]=make_pair(h[a[2]].first+1,x);
	}else h[x]=make_pair(-1,0);
}

void dfs1(int x,int pre){
	for(int i=0;i<son[x].size();++i){
		if(son[x][i]!=pre)
			dfs1(son[x][i],x);
	}
	sort(son[x].begin(),son[x].end(),cmp);
	vector<int> b=son[x];
	if(pre!=0) b.erase(find(b.begin(),b.end(),pre));
	updata(x,b);
}
void dfs2(int x,int pre){
	pair<int,int> rh=h[x];
	updata(x,son[x]);
	if(h[x].first!=-1)
		ans.push_back(h[x].second);
	for(int i=0;i<son[x].size();++i)
		if(son[x][i]!=pre){
			vector<int> b=son[x];
			b.erase(find(b.begin(),b.end(),son[x][i]));
			updata(x,b);
			dfs2(son[x][i],x);
		}
	h[x]=rh;
}
int main(){
	int n; scanf("%d",&n);
	for(int i=1;i<=(1<<n)-3;++i){
		int x,y; scanf("%d%d",&x,&y);
		son[x].push_back(y);
		son[y].push_back(x);
	}
	for(int i=1;i<=(1<<n)-2;++i)
		if(son[i].size()>4){
			puts("0");
			return 0;
		}
	dfs1(1,0);
	dfs2(1,0);
	sort(ans.begin(),ans.end());
	ans.erase(unique(ans.begin(),ans.end()),ans.end());
	printf("%d\n",(int)ans.size());
	for(auto x:ans) printf("%d ",x);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAX_N=1<<17|5;
pair<int,int> h[MAX_N];
vector<int> son[MAX_N],ans;
bool cmp(int x,int y){ return h[x]<h[y]; }
void updata(int x,vector<int> a){
	int sum=0;
	for(int i=0;i<a.size();++i)
		if(h[a[i]].second>0){
			if(sum>0){
				h[x]=make_pair(-1,0);
				return;
			}
			sum+=h[a[i]].second;
		}
	if(a.size()==0){
		h[x]=make_pair(1,0);
	}else if(a.size()==1&&h[a[0]].first==1){
		h[x]=make_pair(2,x);
	}else if(a.size()==2&&h[a[0]].first==h[a[1]].first){
		h[x]=make_pair(h[a[0]].first+1,sum);
	}else if(a.size()==3&&h[a[0]].first==h[a[1]].first
				&&h[a[0]].first+1==h[a[2]].first&&sum==0){
		h[x]=make_pair(h[a[2]].first+1,x);
	}else h[x]=make_pair(-1,0);
}

void dfs1(int x,int pre){
	for(int i=0;i<son[x].size();++i){
		if(son[x][i]!=pre)
			dfs1(son[x][i],x);
	}
	sort(son[x].begin(),son[x].end(),cmp);
	vector<int> b=son[x];
	if(pre!=0) b.erase(find(b.begin(),b.end(),pre));
	updata(x,b);
}
void dfs2(int x,int pre){
	pair<int,int> rh=h[x];
	updata(x,son[x]);
	if(h[x].first!=-1)
		ans.push_back(h[x].second);
	for(int i=0;i<son[x].size();++i)
		if(son[x][i]!=pre){
			vector<int> b=son[x];
			b.erase(find(b.begin(),b.end(),son[x][i]));
			updata(x,b);
			dfs2(son[x][i],x);
		}
}
int main(){
	int n; scanf("%d",&n);
	for(int i=1;i<=(1<<n)-3;++i){
		int x,y; scanf("%d%d",&x,&y);
		son[x].push_back(y);
		son[y].push_back(x);
	}
	for(int i=0;i<=(1<<n)-2;++i)
		if(son[i].size()>4){
			puts("0");
			return 0;
		}
	dfs1(1,0);
	dfs2(1,0);
	sort(ans.begin(),ans.end());
	ans.erase(unique(ans.begin(),ans.end()),ans.end());
	printf("%d\n",(int)ans.size());
	for(auto x:ans) printf("%d ",x);
	return 0;
}


#include<bits/stdc++.h>

const int N=200005;

int n,m,cnt,last[N],f[N],g[N],u,v,mx,deg[N];
struct edge{int to,next;}e[N*2];

void addedge(int u,int v)
{
	e[++cnt].to=v;e[cnt].next=last[u];last[u]=cnt;
	e[++cnt].to=u;e[cnt].next=last[v];last[v]=cnt;
}

void dfs(int x,int dis,int fa)
{
	if (dis>mx) u=x,mx=dis;
	for (int i=last[x];i;i=e[i].next)
		if (e[i].to!=fa) dfs(e[i].to,dis+1,x);
}

int find(int x,int y,int fa,int d1,int d2)
{
	if (x==y) return n+1;
	for (int i=last[x];i;i=e[i].next)
	{
		if (e[i].to==fa) continue;
		int p=find(e[i].to,y,x,d1+1,d2);
		if (!p) continue;
		if (p<=n) return p;
		else if (d1==d2) return x;
		else return n+1;
	}
	return 0;
}

bool check(int x,int fa,int dep)
{
	if (dep>n-1) return 0;
	g[x]=dep;
	for (int i=last[x];i;i=e[i].next)
	{
		if (e[i].to==fa) continue;
		f[e[i].to]=x;
		if (!check(e[i].to,x,dep+1)) return 0;
		g[x]=std::max(g[x],g[e[i].to]);
	}
	return 1;
}

void work1()
{
	int s1=0,s2=0,s3=0,p1,p2;
	for (int i=1;i<=n;i++)
		if (deg[i]==1) s1++;
		else if (deg[i]==2) s2++,p2=p1,p1=i;
		else if (deg[i]==3) s3++;
		else return;
	if (s1!=(1<<(m-1))-1||s2!=2) return;
	int r=find(u,v,0,0,m-1);
	if (check(r,0,0)) {printf("1\n%d\n",p1==r?p2:p1);exit(0);}
}

void work2()
{
	int s1=0,s2=0,s3=0,s4=0,pos,r;
	for (int i=1;i<=n;i++)
		if (deg[i]==1) s1++;
		else if (deg[i]==2) s2++,r=i;
		else if (deg[i]==3) s3++;
		else if (deg[i]==4) s4++,pos=i;
		else return;
	if (s1!=(1<<(m-1))||s4!=1||s2!=1) return;
	if (mx&1)
	{
		if (!check(r,0,0)) return;
		if (f[pos]!=r) return;
		int s4=0,s5=0;
		for (int i=last[pos];i;i=e[i].next)
			if (e[i].to!=f[pos])
			{
				if (g[e[i].to]==m-1) s4++;
				else if (g[e[i].to]==m-2) s5++;
			}
		if (s4!=1||s5!=2) return;
	}
	else
	{
		if (!check(r,0,0)) return;
		if (f[pos]!=r) return;
		int s4=0,s5=0;
		for (int i=last[pos];i;i=e[i].next)
			if (e[i].to!=f[pos])
			{
				if (g[e[i].to]==m-1) s4++;
				else if (g[e[i].to]==m-2) s5++;
			}
		if (s4!=1||s5!=2) return;
	}
	printf("1\n%d\n",pos);
	exit(0);
}

int main()
{
	scanf("%d",&m);
	n=(1<<m)-2;
	for (int i=1;i<n;i++)
	{
		int x,y;scanf("%d%d",&x,&y);
		addedge(x,y);
		deg[x]++;deg[y]++;
	}
	mx=0;dfs(1,0,0);
	v=u;mx=0;dfs(v,0,0);
	if (n==2) {if (e[1].to>e[2].to) std::swap(e[1].to,e[2].to);printf("2\n%d %d\n",e[1].to,e[2].to);return 0;}
	work1();
	work2();
	puts("0");
	return 0;
}


#include<bits/stdc++.h>

const int N=200005;

int n,m,cnt,last[N],f[N],g[N],u,v,mx,deg[N];
struct edge{int to,next;}e[N*2];

void addedge(int u,int v)
{
	e[++cnt].to=v;e[cnt].next=last[u];last[u]=cnt;
	e[++cnt].to=u;e[cnt].next=last[v];last[v]=cnt;
}

void dfs(int x,int dis,int fa)
{
	if (dis>mx) u=x,mx=dis;
	for (int i=last[x];i;i=e[i].next)
		if (e[i].to!=fa) dfs(e[i].to,dis+1,x);
}

bool check(int x,int fa,int dep)
{
	if (dep>m-1) return 0;
	g[x]=dep;
	for (int i=last[x];i;i=e[i].next)
	{
		if (e[i].to==fa) continue;
		f[e[i].to]=x;
		if (!check(e[i].to,x,dep+1)) return 0;
		g[x]=std::max(g[x],g[e[i].to]);
	}
	return 1;
}

void work1()
{
	int s1=0,s2=0,s3=0,p1,p2;
	for (int i=1;i<=n;i++)
		if (deg[i]==1) s1++;
		else if (deg[i]==2) s2++,p2=p1,p1=i;
		else if (deg[i]==3) s3++;
		else return;
	if (s1!=(1<<(m-1))-1||s2!=2) return;
	int r=p1;
	for (int i=last[p2];i;i=e[i].next)
		if (deg[e[i].to]==1) {r=p2;break;}
	if (check(r,0,0)) {printf("1\n%d\n",p1==r?p2:p1);exit(0);}
}

void work2()
{
	int s1=0,s2=0,s3=0,s4=0,pos,r;
	for (int i=1;i<=n;i++)
		if (deg[i]==1) s1++;
		else if (deg[i]==2) s2++,r=i;
		else if (deg[i]==3) s3++;
		else if (deg[i]==4) s4++,pos=i;
		else return;
	if (s1!=(1<<(m-1))||s4!=1||s2!=1) return;
	if (mx&1)
	{
		if (!check(r,0,0)) return;
		if (f[pos]!=r) return;
		int s4=0,s5=0;
		for (int i=last[pos];i;i=e[i].next)
			if (e[i].to!=f[pos])
			{
				if (g[e[i].to]==m-1) s4++;
				else if (g[e[i].to]==m-2) s5++;
			}
		if (s4!=1||s5!=2) return;
	}
	else
	{
		if (!check(r,0,0)) return;
		if (f[pos]!=r) return;
		int s4=0,s5=0;
		for (int i=last[pos];i;i=e[i].next)
			if (e[i].to!=f[pos])
			{
				if (g[e[i].to]==m-1) s4++;
				else if (g[e[i].to]==m-2) s5++;
			}
		if (s4!=1||s5!=2) return;
	}
	printf("1\n%d\n",pos);
	exit(0);
}

int main()
{
	scanf("%d",&m);
	n=(1<<m)-2;
	for (int i=1;i<n;i++)
	{
		int x,y;scanf("%d%d",&x,&y);
		addedge(x,y);
		deg[x]++;deg[y]++;
	}
	mx=0;dfs(1,0,0);
	v=u;mx=0;dfs(v,0,0);
	if (n==2) {if (e[1].to>e[2].to) std::swap(e[1].to,e[2].to);printf("2\n%d %d\n",e[1].to,e[2].to);return 0;}
	work1();
	work2();
	puts("0");
	return 0;
}


#include<bits/stdc++.h>

const int N=200005;

int n,m,cnt,last[N],f[N],g[N],u,v,mx,deg[N];
struct edge{int to,next;}e[N*2];

void addedge(int u,int v)
{
	e[++cnt].to=v;e[cnt].next=last[u];last[u]=cnt;
	e[++cnt].to=u;e[cnt].next=last[v];last[v]=cnt;
}

void dfs(int x,int dis,int fa)
{
	if (dis>mx) u=x,mx=dis;
	for (int i=last[x];i;i=e[i].next)
		if (e[i].to!=fa) dfs(e[i].to,dis+1,x);
}

bool check(int x,int fa,int dep)
{
	if (dep>m-1) return 0;
	g[x]=dep;
	for (int i=last[x];i;i=e[i].next)
	{
		if (e[i].to==fa) continue;
		f[e[i].to]=x;
		if (!check(e[i].to,x,dep+1)) return 0;
		g[x]=std::max(g[x],g[e[i].to]);
	}
	return 1;
}

void work1()
{
	int s1=0,s2=0,s3=0,p1,p2;
	for (int i=1;i<=n;i++)
		if (deg[i]==1) s1++;
		else if (deg[i]==2) s2++,p2=p1,p1=i;
		else if (deg[i]==3) s3++;
		else return;
	if (s1!=(1<<(m-1))-1||s2!=2) return;
	int r=p1;
	for (int i=last[p2];i;i=e[i].next)
		if (deg[e[i].to]==1) {r=p2;break;}
	if (check(r,0,0)) {printf("1\n%d\n",p1==r?p2:p1);exit(0);}
}

void work2()
{
	int s1=0,s2=0,s3=0,s4=0,pos,r;
	for (int i=1;i<=n;i++)
		if (deg[i]==1) s1++;
		else if (deg[i]==2) s2++,r=i;
		else if (deg[i]==3) s3++;
		else if (deg[i]==4) s4++,pos=i;
		else return;
	if (s1!=(1<<(m-1))||s4!=1||s2!=1) return;
	if (mx&1)
	{
		if (!check(r,0,0)) return;
		if (f[pos]!=r) return;
		int s4=0,s5=0;
		for (int i=last[pos];i;i=e[i].next)
			if (e[i].to!=f[pos])
			{
				if (g[e[i].to]==m-1) s4++;
				else if (g[e[i].to]==m-2) s5++;
			}
		if (s4!=1||s5!=2) return;
	}
	else
	{
		if (!check(r,0,0)) return;
		int s4=0,s5=0;
		for (int i=last[pos];i;i=e[i].next)
			if (e[i].to!=f[pos])
			{
				if (g[e[i].to]==m-1) s4++;
				else if (g[e[i].to]==m-2) s5++;
			}
		if (s4!=1||s5!=2) return;
	}
	printf("1\n%d\n",pos);
	exit(0);
}

int main()
{
	scanf("%d",&m);
	n=(1<<m)-2;
	for (int i=1;i<n;i++)
	{
		int x,y;scanf("%d%d",&x,&y);
		addedge(x,y);
		deg[x]++;deg[y]++;
	}
	mx=0;dfs(1,0,0);
	v=u;mx=0;dfs(v,0,0);
	if (n==2) {if (e[1].to>e[2].to) std::swap(e[1].to,e[2].to);printf("2\n%d %d\n",e[1].to,e[2].to);return 0;}
	work1();
	work2();
	puts("0");
	return 0;
}


#include<bits/stdc++.h>

const int N=200005;

int n,m,cnt,last[N],f[N],g[N],u,v,mx,deg[N];
struct edge{int to,next;}e[N*2];

void addedge(int u,int v)
{
	e[++cnt].to=v;e[cnt].next=last[u];last[u]=cnt;
	e[++cnt].to=u;e[cnt].next=last[v];last[v]=cnt;
}

void dfs(int x,int dis,int fa)
{
	if (dis>mx) u=x,mx=dis;
	for (int i=last[x];i;i=e[i].next)
		if (e[i].to!=fa) dfs(e[i].to,dis+1,x);
}

bool check(int x,int fa,int dep)
{
	if (dep>m-1) return 0;
	g[x]=dep;
	for (int i=last[x];i;i=e[i].next)
	{
		if (e[i].to==fa) continue;
		f[e[i].to]=x;
		if (!check(e[i].to,x,dep+1)) return 0;
		g[x]=std::max(g[x],g[e[i].to]);
	}
	return 1;
}

void work1()
{
	int s1=0,s2=0,s3=0,p1,p2;
	for (int i=1;i<=n;i++)
		if (deg[i]==1) s1++;
		else if (deg[i]==2) s2++,p2=p1,p1=i;
		else if (deg[i]==3) s3++;
		else return;
	if (s1!=(1<<(m-1))-1||s2!=2) return;
	int r=p2;
	for (int i=last[p2];i;i=e[i].next)
		if (deg[e[i].to]==1) {r=p1;break;}
	if (check(r,0,0)) {printf("1\n%d\n",p1==r?p2:p1);exit(0);}
}

void work2()
{
	int s1=0,s2=0,s3=0,s4=0,pos,r;
	for (int i=1;i<=n;i++)
		if (deg[i]==1) s1++;
		else if (deg[i]==2) s2++,r=i;
		else if (deg[i]==3) s3++;
		else if (deg[i]==4) s4++,pos=i;
		else return;
	if (s1!=(1<<(m-1))||s4!=1||s2!=1) return;
	if (mx&1)
	{
		if (!check(r,0,0)) return;
		if (f[pos]!=r) return;
		int s4=0,s5=0;
		for (int i=last[pos];i;i=e[i].next)
			if (e[i].to!=f[pos])
			{
				if (g[e[i].to]==m-1) s4++;
				else if (g[e[i].to]==m-2) s5++;
			}
		if (s4!=1||s5!=2) return;
	}
	else
	{
		if (!check(r,0,0)) return;
		int s4=0,s5=0;
		for (int i=last[pos];i;i=e[i].next)
			if (e[i].to!=f[pos])
			{
				if (g[e[i].to]==m-1) s4++;
				else if (g[e[i].to]==m-2) s5++;
			}
		if (s4!=1||s5!=2) return;
	}
	printf("1\n%d\n",pos);
	exit(0);
}

int main()
{
	scanf("%d",&m);
	n=(1<<m)-2;
	for (int i=1;i<n;i++)
	{
		int x,y;scanf("%d%d",&x,&y);
		addedge(x,y);
		deg[x]++;deg[y]++;
	}
	mx=0;dfs(1,0,0);
	v=u;mx=0;dfs(v,0,0);
	if (n==2) {if (e[1].to>e[2].to) std::swap(e[1].to,e[2].to);printf("2\n%d %d\n",e[1].to,e[2].to);return 0;}
	work1();
	work2();
	puts("0");
	return 0;
}


#include<bits/stdc++.h>

const int N=200005;

int n,m,cnt,last[N],f[N],g[N],u,v,mx,deg[N];
struct edge{int to,next;}e[N*2];

void addedge(int u,int v)
{
	e[++cnt].to=v;e[cnt].next=last[u];last[u]=cnt;
	e[++cnt].to=u;e[cnt].next=last[v];last[v]=cnt;
}

void dfs(int x,int dis,int fa)
{
	if (dis>mx) u=x,mx=dis;
	for (int i=last[x];i;i=e[i].next)
		if (e[i].to!=fa) dfs(e[i].to,dis+1,x);
}

bool check(int x,int fa,int dep)
{
	if (dep>m-1) return 0;
	g[x]=dep;
	for (int i=last[x];i;i=e[i].next)
	{
		if (e[i].to==fa) continue;
		f[e[i].to]=x;
		if (!check(e[i].to,x,dep+1)) return 0;
		g[x]=std::max(g[x],g[e[i].to]);
	}
	return 1;
}

void work1()
{
	int s1=0,s2=0,s3=0,p1,p2;
	for (int i=1;i<=n;i++)
		if (deg[i]==1) s1++;
		else if (deg[i]==2) s2++,p2=p1,p1=i;
		else if (deg[i]==3) s3++;
		else return;
	if (s1!=(1<<(m-1))-1||s2!=2) return;
	int r=p2;
	for (int i=last[p2];i;i=e[i].next)
		if (deg[e[i].to]==1) {r=p1;break;}
	if (check(r,0,0)) {printf("1\n%d\n",p1==r?p2:p1);exit(0);}
}

int find(int x,int y,int fa,int d1,int d2)
{
	if (x==y) return n+1;
	for (int i=last[x];i;i=e[i].next)
	{
		if (e[i].to==fa) continue;
		int p=find(e[i].to,y,x,d1+1,d2);
		if (!p) continue;
		if (p<=n) return p;
		else if (d1==d2) return x;
		else return n+1;
	}
	return 0;
}

void work2()
{
	if (mx&1)
	{
		int s1=0,s3=0;
		for (int i=1;i<=n;i++)
			if (deg[i]==1) s1++;
			else if (deg[i]==3) s3++;
			else return;
		if (s1!=(1<<(m-1))) return;
		int r1=find(u,v,0,0,m-1),r2=find(v,u,0,0,m-1);
		if (!check(r1,0,0)||!check(r2,0,0)) return;
		if (r1>r2) std::swap(r1,r2);
		printf("2\n%d %d\n",r1,r2);
	}
	else
	{
		int s1=0,s2=0,s3=0,s4=0,pos,r;
		for (int i=1;i<=n;i++)
			if (deg[i]==1) s1++;
			else if (deg[i]==2) s2++,r=i;
			else if (deg[i]==3) s3++;
			else if (deg[i]==4) s4++,pos=i;
			else return;
		if (s1!=(1<<(m-1))||s4!=1||s2!=1) return;
		if (!check(r,0,0)) return;
		int s5=0,s6=0;
		for (int i=last[pos];i;i=e[i].next)
			if (e[i].to!=f[pos])
			{
				if (g[e[i].to]==m-1) s5++;
				else if (g[e[i].to]==m-2) s6++;
			}
		if (s5!=1||s6!=2) return;
		printf("1\n%d\n",pos);
	}
	exit(0);
}

int main()
{
	scanf("%d",&m);
	n=(1<<m)-2;
	for (int i=1;i<n;i++)
	{
		int x,y;scanf("%d%d",&x,&y);
		addedge(x,y);
		deg[x]++;deg[y]++;
	}
	mx=0;dfs(1,0,0);
	v=u;mx=0;dfs(v,0,0);
	if (n==2) {if (e[1].to>e[2].to) std::swap(e[1].to,e[2].to);printf("2\n%d %d\n",e[1].to,e[2].to);return 0;}
	work1();
	work2();
	puts("0");
	return 0;
}


// Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>

using namespace std;

#define double long double
#define Long long long
#define EPS 1e-12
#define PI acos(-1.0)

#define MAX (1 << 17)
#define MOD 1000000007

#define POS_INF (1LL << 60)
#define NEG_INF (-(1LL << 60))

#define RIGHT_MOST_INDEX (1 << 30)
#define LEFT_MOST_INDEX (-(1 << 30))

#define MEMSET(x,y) memset(x, y, sizeof(x))
#define PB push_back
#define MP make_pair
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());

vector<int> adj[MAX+9], VEC1, VEC2, ANS, TT;
int FLAG[MAX+9];

int main()
{
    int i,j,k,l,cas,ne,test,n,m,x,y,temp,val,now, q, w, e, root, flag, ii, o, p;

    cin>>n;
    m = (1 << n) - 3;

    for(i=1; i<=m; i++)
    {
        cin>>j>>k;
        adj[j].PB(k);
        adj[k].PB(j);
    }

    if(n == 2)
    {
        cout<<2<<endl;
        cout<<1<<" "<<2<<endl;
        return 0;
    }

    x = y = 0;
    for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 2) x++;
    for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 4) y++;

    if(x > 0)
    {
        if(y > 0)
        {
            if(y == 1 && x == 1)
            {
                for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 4) val = i;
                for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 2) root = i;
                TT = adj[val];

                flag = 0;
                for(q=0; q<4 && !flag; q++)
                {
                    for(w=0; w<4 && !flag; w++)
                    {
                        if(q == w) continue;

                        adj[val].clear();
                        adj[(1<<n) - 1].clear();

                        for(e=0; e<4; e++)
                        {
                            ii = TT[e];
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), val), adj[ii].end());
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), ((1<<n) - 1)), adj[ii].end());
                        }

                        for(e=0; e<4; e++)
                        {
                            ii = TT[e];
                            adj[ii].PB(val);
                            adj[val].PB(ii);
                        }

                        for(e=0; e<4; e++)
                        {
                            if(e == w) continue;
                            if(e == q) continue;

                            ii = TT[e];
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), val), adj[ii].end());
                            adj[val].erase(remove(adj[val].begin(), adj[val].end(), ii), adj[val].end());

                            adj[ii].PB((1<<n) - 1);
                            adj[(1<<n) - 1].PB(ii);
                        }

                        adj[val].PB((1<<n) - 1);
                        adj[(1<<n) - 1].PB(val);

                        VEC1.clear();
                        VEC1.PB(root);

                        MEMSET(FLAG, 0);
                        temp = 0;

                        while(VEC1.size() > 0)
                        {
                            if(VEC1.size() != (1 << (temp))) break;

                            VEC2.clear();
                            for(j=0; j<VEC1.size(); j++)
                            {
                                FLAG[VEC1[j]] = 1;
                                for(k=0; k<adj[VEC1[j]].size(); k++)
                                {
                                    if(FLAG[adj[VEC1[j]][k]] == 0)
                                    {
                                        VEC2.PB(adj[VEC1[j]][k]);
                                    }
                                }
                            }

                            SORT(VEC2);
                            VEC1.clear();
                            for(j=0; j<VEC2.size(); j++)
                            {
                                if(j) if(VEC2[j] == VEC2[j-1]) continue;
                                VEC1.PB(VEC2[j]);
                            }

                            temp++;
                        }

                        if(n == temp)
                        {
                            flag = 1;
                        }
                    }
                }

                if(flag) ANS.PB(val);
            }
        }
        else if(x == 2)
        {
            for(i=1; i<=((1 << n) - 2); i++)
            {
                if(adj[i].size() == 2)
                {
                    VEC1.clear();
                    VEC1.PB(i);

                    MEMSET(FLAG, 0);
                    temp = 0;

                    while(VEC1.size() > 0)
                    {
                        if(temp != n-1) if(VEC1.size() != (1 << (temp))) break;
                        if(temp == n-1) if(VEC1.size() != ((1 << (temp)) - 1)) break;

                        VEC2.clear();
                        for(j=0; j<VEC1.size(); j++)
                        {
                            FLAG[VEC1[j]] = 1;
                            for(k=0; k<adj[VEC1[j]].size(); k++)
                            {
                                if(FLAG[adj[VEC1[j]][k]] == 0)
                                {
                                    VEC2.PB(adj[VEC1[j]][k]);
                                }
                            }
                        }

                        SORT(VEC2);
                        VEC1.clear();
                        for(j=0; j<VEC2.size(); j++)
                        {
                            if(j) if(VEC2[j] == VEC2[j-1]) continue;
                            VEC1.PB(VEC2[j]);
                        }

                        temp++;
                    }

                    if(n == temp)
                    {
                        for(j=1; j<=((1 << n) - 2); j++) if(adj[j].size() == 2 && i != j) ANS.PB(j);
                    }
                }
            }
        }
    }
    else
    {
        VEC1.clear();
        MEMSET(FLAG, 0);
        for(i=1; i<=((1 << n) - 2); i++) if(adj[i].size() == 1) VEC1.PB(i);

        for(i=n; i>2; i--)
        {
            if(VEC1.size() != (1 << (i-1))) break;

            VEC2.clear();
            for(j=0; j<VEC1.size(); j++)
            {
                FLAG[VEC1[j]] = 1;
                for(k=0; k<adj[VEC1[j]].size(); k++)
                {
                    if(FLAG[adj[VEC1[j]][k]] == 0)
                    {
                        VEC2.PB(adj[VEC1[j]][k]);
                    }
                }
            }

            SORT(VEC2);
            VEC1.clear();
            for(j=0; j<VEC2.size(); j++)
            {
                temp = VEC2[j];
                if(j) if(VEC2[j] == VEC2[j-1]) continue;
                VEC1.PB(VEC2[j]);
            }

            ANS = VEC1;
        }

        if(i != 2 || VEC1.size() != 2) ANS.clear();
    }

    cout<<ANS.size()<<endl;
    for(i=0; i<ANS.size(); i++) cout<<ANS[i]<<" ";
    cout<<endl;

}


// Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>

using namespace std;

#define double long double
#define Long long long
#define EPS 1e-12
#define PI acos(-1.0)

#define MAX 1000000
#define MOD 1000000007

#define POS_INF (1LL << 60)
#define NEG_INF (-(1LL << 60))

#define RIGHT_MOST_INDEX (1 << 30)
#define LEFT_MOST_INDEX (-(1 << 30))

#define MEMSET(x,y) memset(x, y, sizeof(x))
#define PB push_back
#define MP make_pair
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());

vector<int> adj[MAX+9], VEC1, VEC2, ANS, TT;
int FLAG[MAX+9];

int main()
{
    int i,j,k,l,cas,ne,test,n,m,x,y,temp,val,now, q, w, e, root, flag, ii, o, p;

    cin>>n;
    m = (1 << n) - 3;

    for(i=1; i<=m; i++)
    {
        cin>>j>>k;
        adj[j].PB(k);
        adj[k].PB(j);
    }

    if(n == 2)
    {
        cout<<2<<endl;
        cout<<1<<" "<<2<<endl;
        return 0;
    }

    x = y = 0;
    for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 2) x++;
    for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 4) y++;

    if(n == 17) cout<<x<<" "<<y<<endl;

    if(x > 0)
    {
        if(y > 0)
        {
            if(y == 1 && x == 1)
            {
                for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 4) val = i;
                for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 2) root = i;
                TT = adj[val];

                flag = 0;
                for(q=0; q<4 && !flag; q++)
                {
                    for(w=0; w<4 && !flag; w++)
                    {
                        if(q == w) continue;

                        adj[val].clear();
                        adj[(1<<n) - 1].clear();

                        for(e=0; e<4; e++)
                        {
                            ii = TT[e];
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), val), adj[ii].end());
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), ((1<<n) - 1)), adj[ii].end());
                        }

                        for(e=0; e<4; e++)
                        {
                            ii = TT[e];
                            adj[ii].PB(val);
                            adj[val].PB(ii);
                        }

                        for(e=0; e<4; e++)
                        {
                            if(e == w) continue;
                            if(e == q) continue;

                            ii = TT[e];
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), val), adj[ii].end());
                            adj[val].erase(remove(adj[val].begin(), adj[val].end(), ii), adj[val].end());

                            adj[ii].PB((1<<n) - 1);
                            adj[(1<<n) - 1].PB(ii);
                        }

                        adj[val].PB((1<<n) - 1);
                        adj[(1<<n) - 1].PB(val);

//                        cout<<"\nNew: "<<endl;
//                        for(p=1;p<=((1<<n)-1);p++)
//                        {
//                            cout<<p<<" ->   ";
//                            for(o=0;o<adj[p].size();o++)
//                            {
//                                cout<<adj[p][o]<<" ";
//                            }
//                            cout<<endl;
//                        }

                        VEC1.clear();
                        VEC1.PB(root);

                        MEMSET(FLAG, 0);
                        temp = 0;

                        while(VEC1.size() > 0)
                        {
                            if(VEC1.size() != (1 << (temp))) break;

                            VEC2.clear();
                            for(j=0; j<VEC1.size(); j++)
                            {
                                FLAG[VEC1[j]] = 1;
                                for(k=0; k<adj[VEC1[j]].size(); k++)
                                {
                                    if(FLAG[adj[VEC1[j]][k]] == 0)
                                    {
                                        VEC2.PB(adj[VEC1[j]][k]);
                                    }
                                }
                            }

                            SORT(VEC2);
                            VEC1.clear();
                            for(j=0; j<VEC2.size(); j++)
                            {
                                if(j) if(VEC2[j] == VEC2[j-1]) continue;
                                VEC1.PB(VEC2[j]);
                            }

                            temp++;
                        }

                        if(n == temp)
                        {
                            flag = 1;
                        }
                    }
                }

                if(flag) ANS.PB(val);
            }
        }
        else
        {
            for(i=1; i<=((1 << n) - 2); i++)
            {
                if(adj[i].size() == 2)
                {
                    VEC1.clear();
                    VEC1.PB(i);

                    MEMSET(FLAG, 0);
                    temp = 0;

                    while(VEC1.size() > 0)
                    {
                        if(temp != n-1) if(VEC1.size() != (1 << (temp))) break;
                        if(temp == n-1) if(VEC1.size() != ((1 << (temp)) - 1)) break;

                        VEC2.clear();
                        for(j=0; j<VEC1.size(); j++)
                        {
                            FLAG[VEC1[j]] = 1;
                            for(k=0; k<adj[VEC1[j]].size(); k++)
                            {
                                if(FLAG[adj[VEC1[j]][k]] == 0)
                                {
                                    VEC2.PB(adj[VEC1[j]][k]);
                                }
                            }
                        }

                        SORT(VEC2);
                        VEC1.clear();
                        for(j=0; j<VEC2.size(); j++)
                        {
                            if(j) if(VEC2[j] == VEC2[j-1]) continue;
                            VEC1.PB(VEC2[j]);
                        }

                        temp++;
                    }

                    if(n == temp)
                    {
                        ANS.PB(i);
                    }
                }
            }
        }
    }
    else
    {
        VEC1.clear();
        MEMSET(FLAG, 0);
        for(i=1; i<=((1 << n) - 2); i++) if(adj[i].size() == 1) VEC1.PB(i);

        for(i=n; i>2; i--)
        {
            if(VEC1.size() != (1 << (i-1))) break;

            VEC2.clear();
            for(j=0; j<VEC1.size(); j++)
            {
                FLAG[VEC1[j]] = 1;
                for(k=0; k<adj[VEC1[j]].size(); k++)
                {
                    if(FLAG[adj[VEC1[j]][k]] == 0)
                    {
                        VEC2.PB(adj[VEC1[j]][k]);
                    }
                }
            }

            SORT(VEC2);
            VEC1.clear();
            for(j=0; j<VEC2.size(); j++)
            {
                temp = VEC2[j];
                if(j) if(VEC2[j] == VEC2[j-1]) continue;
                VEC1.PB(VEC2[j]);
            }

            ANS = VEC1;
        }

        if(i != 2 || VEC1.size() != 2) ANS.clear();
    }

    cout<<ANS.size()<<endl;
    for(i=0; i<ANS.size(); i++) cout<<ANS[i]<<" ";
    cout<<endl;

}


// Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>

using namespace std;

#define double long double
#define Long long long
#define EPS 1e-12
#define PI acos(-1.0)

#define MAX 1000000
#define MOD 1000000007

#define POS_INF (1LL << 60)
#define NEG_INF (-(1LL << 60))

#define RIGHT_MOST_INDEX (1 << 30)
#define LEFT_MOST_INDEX (-(1 << 30))

#define MEMSET(x,y) memset(x, y, sizeof(x))
#define PB push_back
#define MP make_pair
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());

vector<int> adj[MAX+9], VEC1, VEC2, ANS, TT;
int FLAG[MAX+9];

int main()
{
    int i,j,k,l,cas,ne,test,n,m,x,y,temp,val,now, q, w, e, root, flag, ii, o, p;

    cin>>n;
    m = (1 << n) - 3;

    for(i=1; i<=m; i++)
    {
        cin>>j>>k;
        adj[j].PB(k);
        adj[k].PB(j);
    }

    if(n == 2)
    {
        cout<<2<<endl;
        cout<<1<<" "<<2<<endl;
        return 0;
    }

    x = y = 0;
    for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 2) x++;
    for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 4) y++;

    //cout<<x<<" "<<y<<endl;

    if(x > 0)
    {
        if(y > 0)
        {
            if(y == 1 && x == 1)
            {
                for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 4) val = i;
                for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 2) root = i;
                TT = adj[val];

                flag = 0;
                for(q=0; q<4 && !flag; q++)
                {
                    for(w=0; w<4 && !flag; w++)
                    {
                        if(q == w) continue;

                        adj[val].clear();
                        adj[(1<<n) - 1].clear();

                        for(e=0; e<4; e++)
                        {
                            ii = TT[e];
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), val), adj[ii].end());
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), ((1<<n) - 1)), adj[ii].end());
                        }

                        for(e=0; e<4; e++)
                        {
                            ii = TT[e];
                            adj[ii].PB(val);
                            adj[val].PB(ii);
                        }

                        for(e=0; e<4; e++)
                        {
                            if(e == w) continue;
                            if(e == q) continue;

                            ii = TT[e];
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), val), adj[ii].end());
                            adj[val].erase(remove(adj[val].begin(), adj[val].end(), ii), adj[val].end());

                            adj[ii].PB((1<<n) - 1);
                            adj[(1<<n) - 1].PB(ii);
                        }

                        adj[val].PB((1<<n) - 1);
                        adj[(1<<n) - 1].PB(val);

//                        cout<<"\nNew: "<<endl;
//                        for(p=1;p<=((1<<n)-1);p++)
//                        {
//                            cout<<p<<" ->   ";
//                            for(o=0;o<adj[p].size();o++)
//                            {
//                                cout<<adj[p][o]<<" ";
//                            }
//                            cout<<endl;
//                        }

                        VEC1.clear();
                        VEC1.PB(root);

                        MEMSET(FLAG, 0);
                        temp = 0;

                        while(VEC1.size() > 0)
                        {
                            if(VEC1.size() != (1 << (temp))) break;

                            VEC2.clear();
                            for(j=0; j<VEC1.size(); j++)
                            {
                                FLAG[VEC1[j]] = 1;
                                for(k=0; k<adj[VEC1[j]].size(); k++)
                                {
                                    if(FLAG[adj[VEC1[j]][k]] == 0)
                                    {
                                        VEC2.PB(adj[VEC1[j]][k]);
                                    }
                                }
                            }

                            SORT(VEC2);
                            VEC1.clear();
                            for(j=0; j<VEC2.size(); j++)
                            {
                                if(j) if(VEC2[j] == VEC2[j-1]) continue;
                                VEC1.PB(VEC2[j]);
                            }

                            temp++;
                        }

                        if(n == temp)
                        {
                            flag = 1;
                        }
                    }
                }

                if(flag) ANS.PB(val);
            }
        }
        else
        {
            for(i=1; i<=((1 << n) - 2); i++)
            {
                if(adj[i].size() == 2)
                {
                    VEC1.clear();
                    VEC1.PB(i);

                    MEMSET(FLAG, 0);
                    temp = 0;

                    while(VEC1.size() > 0)
                    {
                        if(temp != n-1) if(VEC1.size() != (1 << (temp))) break;
                        if(temp == n-1) if(VEC1.size() != ((1 << (temp)) - 1)) break;

                        VEC2.clear();
                        for(j=0; j<VEC1.size(); j++)
                        {
                            FLAG[VEC1[j]] = 1;
                            for(k=0; k<adj[VEC1[j]].size(); k++)
                            {
                                if(FLAG[adj[VEC1[j]][k]] == 0)
                                {
                                    VEC2.PB(adj[VEC1[j]][k]);
                                }
                            }
                        }

                        SORT(VEC2);
                        VEC1.clear();
                        for(j=0; j<VEC2.size(); j++)
                        {
                            if(j) if(VEC2[j] == VEC2[j-1]) continue;
                            VEC1.PB(VEC2[j]);
                        }

                        temp++;
                    }

                    if(n == temp)
                    {
                        ANS.PB(i);
                    }
                }
            }
        }
    }
    else
    {
        VEC1.clear();
        MEMSET(FLAG, 0);
        for(i=1; i<=((1 << n) - 2); i++) if(adj[i].size() == 1) VEC1.PB(i);

        for(i=n; i>2; i--)
        {
            if(VEC1.size() != (1 << (i-1))) break;

            VEC2.clear();
            for(j=0; j<VEC1.size(); j++)
            {
                FLAG[VEC1[j]] = 1;
                for(k=0; k<adj[VEC1[j]].size(); k++)
                {
                    if(FLAG[adj[VEC1[j]][k]] == 0)
                    {
                        VEC2.PB(adj[VEC1[j]][k]);
                    }
                }
            }

            SORT(VEC2);
            VEC1.clear();
            for(j=0; j<VEC2.size(); j++)
            {
                temp = VEC2[j];
                if(j) if(VEC2[j] == VEC2[j-1]) continue;
                VEC1.PB(VEC2[j]);
            }

            ANS = VEC1;
        }

        if(i != 2 || VEC1.size() != 2) ANS.clear();
    }

    cout<<ANS.size()<<endl;
    for(i=0; i<ANS.size(); i++) cout<<ANS[i]<<" ";
    cout<<endl;

}


// Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>

using namespace std;

#define double long double
#define Long long long
#define EPS 1e-12
#define PI acos(-1.0)

#define MAX (1 << 17)
#define MOD 1000000007

#define POS_INF (1LL << 60)
#define NEG_INF (-(1LL << 60))

#define RIGHT_MOST_INDEX (1 << 30)
#define LEFT_MOST_INDEX (-(1 << 30))

#define MEMSET(x,y) memset(x, y, sizeof(x))
#define PB push_back
#define MP make_pair
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());

vector<int> adj[MAX+9], VEC1, VEC2, ANS, TT;
int FLAG[MAX+9];

int main()
{
    int i,j,k,l,cas,ne,test,n,m,x,y,temp,val,now, q, w, e, root, flag, ii, o, p;

    cin>>n;
    m = (1 << n) - 3;

    for(i=1; i<=m; i++)
    {
        cin>>j>>k;
        adj[j].PB(k);
        adj[k].PB(j);
    }

    if(n == 2)
    {
        cout<<2<<endl;
        cout<<1<<" "<<2<<endl;
        return 0;
    }

    x = y = 0;
    for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 2) x++;
    for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 4) y++;

    if(x > 0)
    {
        if(y > 0)
        {
            if(y == 1 && x == 1)
            {
                for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 4) val = i;
                for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 2) root = i;
                TT = adj[val];

                flag = 0;
                for(q=0; q<4 && !flag; q++)
                {
                    for(w=0; w<4 && !flag; w++)
                    {
                        if(q == w) continue;

                        adj[val].clear();
                        adj[(1<<n) - 1].clear();

                        for(e=0; e<4; e++)
                        {
                            ii = TT[e];
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), val), adj[ii].end());
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), ((1<<n) - 1)), adj[ii].end());
                        }

                        for(e=0; e<4; e++)
                        {
                            ii = TT[e];
                            adj[ii].PB(val);
                            adj[val].PB(ii);
                        }

                        for(e=0; e<4; e++)
                        {
                            if(e == w) continue;
                            if(e == q) continue;

                            ii = TT[e];
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), val), adj[ii].end());
                            adj[val].erase(remove(adj[val].begin(), adj[val].end(), ii), adj[val].end());

                            adj[ii].PB((1<<n) - 1);
                            adj[(1<<n) - 1].PB(ii);
                        }

                        adj[val].PB((1<<n) - 1);
                        adj[(1<<n) - 1].PB(val);

                        VEC1.clear();
                        VEC1.PB(root);

                        MEMSET(FLAG, 0);
                        temp = 0;

                        while(VEC1.size() > 0)
                        {
                            if(VEC1.size() != (1 << (temp))) break;

                            VEC2.clear();
                            for(j=0; j<VEC1.size(); j++)
                            {
                                FLAG[VEC1[j]] = 1;
                                for(k=0; k<adj[VEC1[j]].size(); k++)
                                {
                                    if(FLAG[adj[VEC1[j]][k]] == 0)
                                    {
                                        VEC2.PB(adj[VEC1[j]][k]);
                                    }
                                }
                            }

                            SORT(VEC2);
                            VEC1.clear();
                            for(j=0; j<VEC2.size(); j++)
                            {
                                if(j) if(VEC2[j] == VEC2[j-1]) continue;
                                VEC1.PB(VEC2[j]);
                            }

                            temp++;
                        }

                        if(n == temp)
                        {
                            flag = 1;
                        }
                    }
                }

                if(flag) ANS.PB(val);
            }
        }
        else
        {
            for(i=1; i<=((1 << n) - 2); i++)
            {
                if(adj[i].size() == 2)
                {
                    VEC1.clear();
                    VEC1.PB(i);

                    MEMSET(FLAG, 0);
                    temp = 0;

                    while(VEC1.size() > 0)
                    {
                        if(temp != n-1) if(VEC1.size() != (1 << (temp))) break;
                        if(temp == n-1) if(VEC1.size() != ((1 << (temp)) - 1)) break;

                        VEC2.clear();
                        for(j=0; j<VEC1.size(); j++)
                        {
                            FLAG[VEC1[j]] = 1;
                            for(k=0; k<adj[VEC1[j]].size(); k++)
                            {
                                if(FLAG[adj[VEC1[j]][k]] == 0)
                                {
                                    VEC2.PB(adj[VEC1[j]][k]);
                                }
                            }
                        }

                        SORT(VEC2);
                        VEC1.clear();
                        for(j=0; j<VEC2.size(); j++)
                        {
                            if(j) if(VEC2[j] == VEC2[j-1]) continue;
                            VEC1.PB(VEC2[j]);
                        }

                        temp++;
                    }

                    if(n == temp)
                    {
                        for(j=1; j<=((1 << n) - 2); j++) if(adj[j].size() == 2 && i != j) ANS.PB(j);
                    }
                }
            }
        }
    }
    else
    {
        VEC1.clear();
        MEMSET(FLAG, 0);
        for(i=1; i<=((1 << n) - 2); i++) if(adj[i].size() == 1) VEC1.PB(i);

        for(i=n; i>2; i--)
        {
            if(VEC1.size() != (1 << (i-1))) break;

            VEC2.clear();
            for(j=0; j<VEC1.size(); j++)
            {
                FLAG[VEC1[j]] = 1;
                for(k=0; k<adj[VEC1[j]].size(); k++)
                {
                    if(FLAG[adj[VEC1[j]][k]] == 0)
                    {
                        VEC2.PB(adj[VEC1[j]][k]);
                    }
                }
            }

            SORT(VEC2);
            VEC1.clear();
            for(j=0; j<VEC2.size(); j++)
            {
                temp = VEC2[j];
                if(j) if(VEC2[j] == VEC2[j-1]) continue;
                VEC1.PB(VEC2[j]);
            }

            ANS = VEC1;
        }

        if(i != 2 || VEC1.size() != 2) ANS.clear();
    }

    cout<<ANS.size()<<endl;
    for(i=0; i<ANS.size(); i++) cout<<ANS[i]<<" ";
    cout<<endl;

}


// Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>

using namespace std;

#define double long double
#define Long long long
#define EPS 1e-12
#define PI acos(-1.0)

#define MAX 1000000
#define MOD 1000000007

#define POS_INF (1LL << 60)
#define NEG_INF (-(1LL << 60))

#define RIGHT_MOST_INDEX (1 << 30)
#define LEFT_MOST_INDEX (-(1 << 30))

#define MEMSET(x,y) memset(x, y, sizeof(x))
#define PB push_back
#define MP make_pair
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());

vector<int> adj[MAX+9], VEC1, VEC2, ANS, TT;
int FLAG[MAX+9];

int main()
{
    int i,j,k,l,cas,ne,test,n,m,x,y,temp,val,now, q, w, e, root, flag, ii, o, p;

    cin>>n;
    m = (1 << n) - 3;

    for(i=1; i<=m; i++)
    {
        cin>>j>>k;
        adj[j].PB(k);
        adj[k].PB(j);
    }

    if(n == 2)
    {
        cout<<2<<endl;
        cout<<1<<" "<<2<<endl;
        return 0;
    }

    x = y = 0;
    for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 2) x++;
    for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 4) y++;

    //if(n == 17) cout<<x<<" "<<y<<endl;

    if(x > 0)
    {
        if(y > 0)
        {
            if(y == 1 && x == 1)
            {
                for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 4) val = i;
                for(i=1; i<=((1<<n) - 1); i++) if(adj[i].size() == 2) root = i;
                TT = adj[val];

                flag = 0;
                for(q=0; q<4 && !flag; q++)
                {
                    for(w=0; w<4 && !flag; w++)
                    {
                        if(q == w) continue;

                        adj[val].clear();
                        adj[(1<<n) - 1].clear();

                        for(e=0; e<4; e++)
                        {
                            ii = TT[e];
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), val), adj[ii].end());
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), ((1<<n) - 1)), adj[ii].end());
                        }

                        for(e=0; e<4; e++)
                        {
                            ii = TT[e];
                            adj[ii].PB(val);
                            adj[val].PB(ii);
                        }

                        for(e=0; e<4; e++)
                        {
                            if(e == w) continue;
                            if(e == q) continue;

                            ii = TT[e];
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), val), adj[ii].end());
                            adj[val].erase(remove(adj[val].begin(), adj[val].end(), ii), adj[val].end());

                            adj[ii].PB((1<<n) - 1);
                            adj[(1<<n) - 1].PB(ii);
                        }

                        adj[val].PB((1<<n) - 1);
                        adj[(1<<n) - 1].PB(val);

//                        cout<<"\nNew: "<<endl;
//                        for(p=1;p<=((1<<n)-1);p++)
//                        {
//                            cout<<p<<" ->   ";
//                            for(o=0;o<adj[p].size();o++)
//                            {
//                                cout<<adj[p][o]<<" ";
//                            }
//                            cout<<endl;
//                        }

                        VEC1.clear();
                        VEC1.PB(root);

                        MEMSET(FLAG, 0);
                        temp = 0;

                        while(VEC1.size() > 0)
                        {
                            if(VEC1.size() != (1 << (temp))) break;

                            VEC2.clear();
                            for(j=0; j<VEC1.size(); j++)
                            {
                                FLAG[VEC1[j]] = 1;
                                for(k=0; k<adj[VEC1[j]].size(); k++)
                                {
                                    if(FLAG[adj[VEC1[j]][k]] == 0)
                                    {
                                        VEC2.PB(adj[VEC1[j]][k]);
                                    }
                                }
                            }

                            SORT(VEC2);
                            VEC1.clear();
                            for(j=0; j<VEC2.size(); j++)
                            {
                                if(j) if(VEC2[j] == VEC2[j-1]) continue;
                                VEC1.PB(VEC2[j]);
                            }

                            temp++;
                        }

                        if(n == temp)
                        {
                            flag = 1;
                        }
                    }
                }

                if(flag) ANS.PB(val);
            }
        }
        else if(x == 2)
        {
            for(i=1; i<=((1 << n) - 2); i++)
            {
                if(adj[i].size() == 2)
                {
                    VEC1.clear();
                    VEC1.PB(i);

                    MEMSET(FLAG, 0);
                    temp = 0;

                    while(VEC1.size() > 0)
                    {
                        if(temp != n-1) if(VEC1.size() != (1 << (temp))) break;
                        if(temp == n-1) if(VEC1.size() != ((1 << (temp)) - 1)) break;

                        VEC2.clear();
                        for(j=0; j<VEC1.size(); j++)
                        {
                            FLAG[VEC1[j]] = 1;
                            for(k=0; k<adj[VEC1[j]].size(); k++)
                            {
                                if(FLAG[adj[VEC1[j]][k]] == 0)
                                {
                                    VEC2.PB(adj[VEC1[j]][k]);
                                }
                            }
                        }

                        SORT(VEC2);
                        VEC1.clear();
                        for(j=0; j<VEC2.size(); j++)
                        {
                            if(j) if(VEC2[j] == VEC2[j-1]) continue;
                            VEC1.PB(VEC2[j]);
                        }

                        temp++;
                    }

                    if(n == temp)
                    {
                        for(j=1; j<=((1 << n) - 2); j++) if(adj[j].size() == 2 && i != j) ANS.PB(j);
                    }
                }
            }
        }
    }
    else
    {
        VEC1.clear();
        MEMSET(FLAG, 0);
        for(i=1; i<=((1 << n) - 2); i++) if(adj[i].size() == 1) VEC1.PB(i);

        for(i=n; i>2; i--)
        {
            if(VEC1.size() != (1 << (i-1))) break;

            VEC2.clear();
            for(j=0; j<VEC1.size(); j++)
            {
                FLAG[VEC1[j]] = 1;
                for(k=0; k<adj[VEC1[j]].size(); k++)
                {
                    if(FLAG[adj[VEC1[j]][k]] == 0)
                    {
                        VEC2.PB(adj[VEC1[j]][k]);
                    }
                }
            }

            SORT(VEC2);
            VEC1.clear();
            for(j=0; j<VEC2.size(); j++)
            {
                temp = VEC2[j];
                if(j) if(VEC2[j] == VEC2[j-1]) continue;
                VEC1.PB(VEC2[j]);
            }

            ANS = VEC1;
        }

        if(i != 2 || VEC1.size() != 2) ANS.clear();
    }

    cout<<ANS.size()<<endl;
    for(i=0; i<ANS.size(); i++) cout<<ANS[i]<<" ";
    cout<<endl;

}


// Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>

using namespace std;

#define double long double
#define Long long long
#define EPS 1e-12
#define PI acos(-1.0)

#define MAX 1000000
#define MOD 1000000007

#define POS_INF (1LL << 60)
#define NEG_INF (-(1LL << 60))

#define RIGHT_MOST_INDEX (1 << 30)
#define LEFT_MOST_INDEX (-(1 << 30))

#define MEMSET(x,y) memset(x, y, sizeof(x))
#define PB push_back
#define MP make_pair
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());

vector<int> adj[MAX+9], VEC1, VEC2, ANS, TT;
int FLAG[MAX+9];

int main()
{
    int i,j,k,l,cas,ne,test,n,m,x,y,temp,val,now, q, w, e, root, flag, ii, o, p;

    cin>>n;
    m = (1 << n) - 3;

    for(i=1; i<=m; i++)
    {
        cin>>j>>k;
        adj[j].PB(k);
        adj[k].PB(j);
    }

    if(n == 2)
    {
        cout<<2<<endl;
        cout<<1<<" "<<2<<endl;
        return 0;
    }

    x = y = 0;
    for(i=1; i<=n; i++) if(adj[i].size() == 2) x++;
    for(i=1; i<=n; i++) if(adj[i].size() == 4) y++;

    if(x > 0)
    {
        if(y > 0)
        {
            if(y == 1 && x == 1)
            {
                for(i=1; i<=n; i++) if(adj[i].size() == 4) val = i;
                for(i=1; i<=n; i++) if(adj[i].size() == 2) root = i;
                TT = adj[val];

                flag = 0;
                for(q=0; q<4 && !flag; q++)
                {
                    for(w=0; w<4 && !flag; w++)
                    {
                        if(q == w) continue;

                        adj[val].clear();
                        adj[(1<<n) - 1].clear();

                        for(e=0; e<4; e++)
                        {
                            ii = TT[e];
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), val), adj[ii].end());
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), ((1<<n) - 1)), adj[ii].end());
                        }

                        for(e=0; e<4; e++)
                        {
                            ii = TT[e];
                            adj[ii].PB(val);
                            adj[val].PB(ii);
                        }

                        for(e=0; e<4; e++)
                        {
                            if(e == w) continue;
                            if(e == q) continue;

                            ii = TT[e];
                            adj[ii].erase(remove(adj[ii].begin(), adj[ii].end(), val), adj[ii].end());
                            adj[val].erase(remove(adj[val].begin(), adj[val].end(), ii), adj[val].end());

                            adj[ii].PB((1<<n) - 1);
                            adj[(1<<n) - 1].PB(ii);
                        }

                        adj[val].PB((1<<n) - 1);
                        adj[(1<<n) - 1].PB(val);

//                        cout<<"\nNew: "<<endl;
//                        for(p=1;p<=((1<<n)-1);p++)
//                        {
//                            cout<<p<<" ->   ";
//                            for(o=0;o<adj[p].size();o++)
//                            {
//                                cout<<adj[p][o]<<" ";
//                            }
//                            cout<<endl;
//                        }

                        VEC1.clear();
                        VEC1.PB(root);

                        MEMSET(FLAG, 0);
                        temp = 0;

                        while(VEC1.size() > 0)
                        {
                            if(VEC1.size() != (1 << (temp))) break;

                            VEC2.clear();
                            for(j=0; j<VEC1.size(); j++)
                            {
                                FLAG[VEC1[j]] = 1;
                                for(k=0; k<adj[VEC1[j]].size(); k++)
                                {
                                    if(FLAG[adj[VEC1[j]][k]] == 0)
                                    {
                                        VEC2.PB(adj[VEC1[j]][k]);
                                    }
                                }
                            }

                            SORT(VEC2);
                            VEC1.clear();
                            for(j=0; j<VEC2.size(); j++)
                            {
                                if(j) if(VEC2[j] == VEC2[j-1]) continue;
                                VEC1.PB(VEC2[j]);
                            }

                            temp++;
                        }

                        if(n == temp)
                        {
                            flag = 1;
                        }
                    }
                }

                if(flag) ANS.PB(val);
            }
        }
        else
        {
            for(i=1; i<=((1 << n) - 2); i++)
            {
                if(adj[i].size() == 2)
                {
                    VEC1.clear();
                    VEC1.PB(i);

                    MEMSET(FLAG, 0);
                    temp = 0;

                    while(VEC1.size() > 0)
                    {
                        if(temp != n-1) if(VEC1.size() != (1 << (temp))) break;
                        if(temp == n-1) if(VEC1.size() != ((1 << (temp)) - 1)) break;

                        VEC2.clear();
                        for(j=0; j<VEC1.size(); j++)
                        {
                            FLAG[VEC1[j]] = 1;
                            for(k=0; k<adj[VEC1[j]].size(); k++)
                            {
                                if(FLAG[adj[VEC1[j]][k]] == 0)
                                {
                                    VEC2.PB(adj[VEC1[j]][k]);
                                }
                            }
                        }

                        SORT(VEC2);
                        VEC1.clear();
                        for(j=0; j<VEC2.size(); j++)
                        {
                            if(j) if(VEC2[j] == VEC2[j-1]) continue;
                            VEC1.PB(VEC2[j]);
                        }

                        temp++;
                    }

                    if(n == temp)
                    {
                        ANS.PB(i);
                    }
                }
            }
        }
    }
    else
    {
        VEC1.clear();
        MEMSET(FLAG, 0);
        for(i=1; i<=((1 << n) - 2); i++) if(adj[i].size() == 1) VEC1.PB(i);

        for(i=n; i>2; i--)
        {
            if(VEC1.size() != (1 << (i-1))) break;

            VEC2.clear();
            for(j=0; j<VEC1.size(); j++)
            {
                FLAG[VEC1[j]] = 1;
                for(k=0; k<adj[VEC1[j]].size(); k++)
                {
                    if(FLAG[adj[VEC1[j]][k]] == 0)
                    {
                        VEC2.PB(adj[VEC1[j]][k]);
                    }
                }
            }

            SORT(VEC2);
            VEC1.clear();
            for(j=0; j<VEC2.size(); j++)
            {
                temp = VEC2[j];
                if(j) if(VEC2[j] == VEC2[j-1]) continue;
                VEC1.PB(VEC2[j]);
            }

            ANS = VEC1;
        }

        if(i != 2 || VEC1.size() != 2) ANS.clear();
    }

    cout<<ANS.size()<<endl;
    for(i=0; i<ANS.size(); i++) cout<<ANS[i]<<" ";
    cout<<endl;

}


#include<bits/stdc++.h>
using namespace std;

const int MX = (1 << 17) + 5;

int cnt[7], siz[MX];
vector<int> G[MX];

int NoSolution() {
	puts("0\n");
	return 0;
}
int Solved(vector<int> val) {
	cout << val.size() << "\n";
	sort(val.begin(), val.end());
	for(int v : val) cout << v << ' ';
	return 0;
}

bool dfs2(int u, int f) {
	vector<int> sonsize;
	siz[u] = 1;
	for(int v : G[u]) if(v != f) {
		if(!dfs2(v, u))
			return false;
		siz[u] += siz[v];
		sonsize.push_back(siz[v]);
	}
	if(G[u].size() == 4) {
		++siz[u];
		sort(sonsize.begin(), sonsize.end());
		return sonsize[0] == sonsize[1] && sonsize[2] == sonsize[0] * 2 + 1;
	} else {
		assert(sonsize.size() == 2 || sonsize.empty());
		return sonsize.empty() || sonsize[0] == sonsize[1];
	}
}

bool check_leaf(int u, int v, int root) {
	static int cnt = 0;
	++cnt;
	G[u].push_back(v);
	G[v].push_back(u);
	if(dfs2(root, -1)) return Solved({u}), true;
	else return false;
}
int solve_leave(int N) {
	int u = -1, v = -1;
	for(int i = 1; i <= N; i++)
		if(G[i].size() == 2) (u == -1 ? u : v) = i;
	if(check_leaf(u, N + 1, v) || check_leaf(v, N + 1, u)) return 0;
	else return NoSolution();
}

bool precheck_mid() {
	int val = cnt[1];
	return cnt[2] == 1 && cnt[4] == 1 && val == (val & -val);
}
int solve_mid(int N) {
	if(!precheck_mid())
		return NoSolution();
	int root = -1, fa = -1;
	for(int i = 1; i <= N; i++) {
		if(G[i].size() == 2) root = i;
		if(G[i].size() == 4) fa = i;
	}
	if(dfs2(root, -1)) return Solved({fa});
	else return NoSolution();
}

int fa[MX], dis[MX];
void dfs3(int u, int f) {
	for(int v : G[u]) if(v != f)
		fa[v] = u, dis[v] = dis[u] + 1, dfs3(v, u);
}
int solve_dep_2(int N) {
	dfs3(1, -1);
	int u = max_element(dis + 1, dis + N + 1) - dis;
	fa[u] = dis[u] = 0;
	dfs3(u, -1);
	int v = max_element(dis + 1, dis + N + 1) - dis;
	if(dis[v] % 2 == 0)
		return NoSolution();
	int k = dis[v] / 2;
	for(int i = 1; i <= k; i++) v = fa[v];
	bool ans = true;
	for(int node : G[v]) if(node != fa[v])
		ans = ans && dfs2(node, v);
	for(int node : G[fa[v]]) if(node != v)
		ans = ans && dfs2(node, fa[v]);
	if(ans)
		return Solved({v, fa[v]});
	else
		return NoSolution();
}

int main() {
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int N = (1 << n) - 2;
	for(int i = 1; i < N; i++) {
		int u, v;
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	for(int i = 1; i <= N; i++) {
		if(G[i].size() >= 5)
			return NoSolution();
		cnt[G[i].size()]++;
	}
	switch(cnt[2]) {
		case 0:
			return solve_dep_2(N);
		case 1:
			return solve_mid(N);
		case 2:
			return solve_leave(N);
		default:
			return NoSolution();
	}
	assert(false);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int MX = (1 << 17) + 5;

int cnt[7], siz[MX];
vector<int> G[MX];

int NoSolution() {
	puts("0\n");
	return 0;
}
int Solved(vector<int> val) {
	cout << val.size() << "\n";
	sort(val.begin(), val.end());
	for(int v : val) cout << v << ' ';
	return 0;
}

bool dfs2(int u, int f) {
	vector<int> sonsize;
	siz[u] = 1;
	for(int v : G[u]) if(v != f) {
		if(!dfs2(v, u))
			return false;
		siz[u] += siz[v];
		sonsize.push_back(siz[v]);
	}
	if(G[u].size() == 4) {
		++siz[u];
		sort(sonsize.begin(), sonsize.end());
		return sonsize[0] == sonsize[1] && sonsize[2] == sonsize[0] * 2 + 1;
	} else {
		assert(sonsize.size() == 2 || sonsize.empty());
		return sonsize.empty() || sonsize[0] == sonsize[1];
	}
}

bool check_leaf(int u, int v, int root) {
	static int cnt = 0;
	++cnt;
	G[u].push_back(v);
	G[v].push_back(u);
	if(dfs2(root, -1))
		return Solved({u}), true;
	else {
		G[u].pop_back();
		G[v].pop_back();
		return false;
	}
}
int solve_leave(int N) {
	int u = -1, v = -1;
	for(int i = 1; i <= N; i++)
		if(G[i].size() == 2) (u == -1 ? u : v) = i;
	if(check_leaf(u, N + 1, v) || check_leaf(v, N + 1, u)) return 0;
	else return NoSolution();
}

bool precheck_mid() {
	int val = cnt[1];
	return cnt[2] == 1 && cnt[4] == 1 && val == (val & -val);
}
int solve_mid(int N) {
	if(!precheck_mid())
		return NoSolution();
	int root = -1, fa = -1;
	for(int i = 1; i <= N; i++) {
		if(G[i].size() == 2) root = i;
		if(G[i].size() == 4) fa = i;
	}
	if(dfs2(root, -1)) return Solved({fa});
	else return NoSolution();
}

int fa[MX], dis[MX];
void dfs3(int u, int f) {
	for(int v : G[u]) if(v != f)
		fa[v] = u, dis[v] = dis[u] + 1, dfs3(v, u);
}
int solve_dep_2(int N) {
	dfs3(1, -1);
	int u = max_element(dis + 1, dis + N + 1) - dis;
	fa[u] = dis[u] = 0;
	dfs3(u, -1);
	int v = max_element(dis + 1, dis + N + 1) - dis;
	if(dis[v] % 2 == 0)
		return NoSolution();
	int k = dis[v] / 2;
	for(int i = 1; i <= k; i++) v = fa[v];
	bool ans = true;
	for(int node : G[v]) if(node != fa[v])
		ans = ans && dfs2(node, v);
	for(int node : G[fa[v]]) if(node != v)
		ans = ans && dfs2(node, fa[v]);
	if(ans)
		return Solved({v, fa[v]});
	else
		return NoSolution();
}

int main() {
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int N = (1 << n) - 2;
	for(int i = 1; i < N; i++) {
		int u, v;
		cin >> u >> v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	for(int i = 1; i <= N; i++) {
		if(G[i].size() >= 5)
			return NoSolution();
		cnt[G[i].size()]++;
	}
	switch(cnt[2]) {
		case 0:
			return solve_dep_2(N);
		case 1:
			return solve_mid(N);
		case 2:
			return solve_leave(N);
		default:
			return NoSolution();
	}
	assert(false);
	return 0;
}