#P17149. [ICPC 2017 Xi'an R] Island
[ICPC 2017 Xi'an R] Island
Problem Description
As a member of The Academy of Chtholly, you want to rush to the battle field to help Chtholly.
There are islands in the sky, and you are in island number .
At first, there are transportation lines, each connecting two islands, making each two islands reachable.
However, due to the continues attack of the beasts on the ground, each transportation line has possibility of being destroyed.
You want to find, in all possible realities (each transportation line may be destroyed or not), how many of them you can reach exactly islands. The answer may be large, so you just need to output the answer mod .
Input Format
The input contains multiple test cases.
The first line contains a number () denoting the number of test cases.
In each test case:
The first line contains a number ().
The following lines each contains two numbers , denoting that there is an edge between and .
Output Format
For each test case, output one line containing numbers.
The -th number is the number of possible realities that you can reach exactly islands.
1
5
1 2
2 3
3 4
4 5
8 4 2 1 1