Codeforces Round 589 (Div. 2)
F
One Node is Gone
Codeforces
2500
原题
← E→
翻译中…

You have an integer $n$. Let's define following tree generation as McDic's generation:

翻译中…
  1. Make a complete and full binary tree of $2^{n} - 1$ vertices. Complete and full binary tree means a tree that exactly one vertex is a root, all leaves have the same depth (distance from the root), and all non-leaf nodes have exactly two child nodes.
  2. Select a non-root vertex $v$ from that binary tree.
  3. Remove $v$ from tree and make new edges between $v$'s parent and $v$'s direct children. If $v$ has no children, then no new edges will be made.
翻译中…

You have a tree. Determine if this tree can be made by McDic's generation. If yes, then find the parent vertex of removed vertex in tree.

翻译中…

Input

翻译中…

The first line contains integer $n$ ($2 \le n \le 17$).

翻译中…

The $i$-th of the next $2^{n} - 3$ lines contains two integers $a_{i}$ and $b_{i}$ ($1 \le a_{i} \lt b_{i} \le 2^{n} - 2$) — meaning there is an edge between $a_{i}$ and $b_{i}$. It is guaranteed that the given edges form a tree.

翻译中…

Output

翻译中…

Print two lines.

翻译中…

In the first line, print a single integer — the number of answers. If given tree cannot be made by McDic's generation, then print $0$.

翻译中…

In the second line, print all possible answers in ascending order, separated by spaces. If the given tree cannot be made by McDic's generation, then don't print anything.

翻译中…

Note

翻译中…

In the first example, $3$ is the only possible answer.

翻译中…

image

翻译中…

In the second example, there are $2$ possible answers.

翻译中…

image

翻译中…

In the third example, the tree can't be generated by McDic's generation.

翻译中…

样例

Input #1
4
1 2
1 3
2 4
2 5
3 6
3 13
3 14
4 7
4 8
5 9
5 10
6 11
6 12
Output #1
1
3
InputCopy OutputCopy
Input #2
2
1 2
Output #2
2
1 2
InputCopy OutputCopy
Input #3
3
1 2
2 3
3 4
4 5
5 6
Output #3
0
InputCopy OutputCopy
题目信息
题号
1228F
时间限制
1 s
内存限制
256 MB
标签
构造
模拟
树

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。