#P7250. Even Tree Split
Even Tree Split
Problem Description
You are given an undirected tree with $n$ nodes. It's guaranteed that $n$ is even.
You are going to delete some of the edges (at least $1$), and have to let each of the remaining connected components have an even number of vertices.
Calculate the number of ways to delete the edges that satisfy such constraints, modulo $998244353$.
Input
The first line contains an integer $T(1 \leq T \leq 30)$ - the number of test cases.
The first line of each test case contains an integer $n(1 \leq n \leq 10^5)$ - the number of vertices on the tree.
The next $n-1$ lines of each test case contain two integers $u,v(1 \leq u,v \leq n)$, representing an edge between $u$ and $v$.
It is guaranteed that the input graph is a tree with even number of vertices.
Output
For each test case, output the number of ways to delete the edges that satisfy such constraints in a single line, modulo $998244353$.
2
2
1 2
4
1 2
2 3
3 4
0
1