#abc269h. [abc269_h]Antichain
[abc269_h]Antichain
Problem Statement
We have a rooted tree with vertices numbered to . Vertex is the root, and the parent of vertex is vertex .
A non-empty subset of the vertex set of is said to be a good vertex set when it satisfies the following condition.
- For every pair of different vertices in , the following holds: is not an ancestor of .
For each , find the number, modulo , of good vertex sets with exactly vertices.
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the answer for .
Sample Input 1
4
1 2 1
Sample Output 1
4
2
0
0
For each , the good vertex sets of size are listed below.
- : $\\lbrace 1 \\rbrace, \\lbrace 2 \\rbrace, \\lbrace 3 \\rbrace, \\lbrace 4 \\rbrace$.
- : .
- : There is none.
Sample Input 2
6
1 1 2 2 5
Sample Output 2
6
6
2
0
0
0
Sample Input 3
6
1 1 1 1 1
Sample Output 3
6
10
10
5
1
0
Sample Input 4
10
1 2 1 2 1 1 2 6 9
Sample Output 4
10
30
47
38
16
3
0
0
0
0