TN was gifted a tree of $$$n$$$ vertices with the root in the vertex $$$1$$$. A tree is a connected undirected graph without cycles.
Initially, the root has already been colored, and he wanted to color all the vertices using the operation below.
During one operation, TN can choose one uncolored vertex whose parent has already been colored and color it.
It can be shown that after $$$n-1$$$ operations, all the vertices will be colored.
Let $$$p_i$$$ be the chosen vertex of the $$$i$$$-th operation. If TN can color all vertices in this way, then the array $$$p$$$ is called Valid.
Count the number of different Valid arrays modulo $$$998244353$$$.
The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 10 ^ 4)$$$, denoting the number of test cases.
The first line of each test case contains a single integer $$$n$$$ $$$(1 \leq n \leq 10 ^ 5)$$$.
The $$$i$$$-th of the next $$$n-1$$$ lines contains two integers $$$u_i$$$, $$$v_i$$$ $$$(1 \leq u_i, v_i \leq n)$$$, denoting the indices of vertices connected by the $$$i$$$-th edge.
It's guaranteed that the sum of $$$n$$$ over all test cases doesn't exceed $$$2 \times 10 ^ 5$$$.
For each test case, output a single integer, denoting the number of different Valid arrays modulo $$$998244353$$$.
431 21 341 22 33 4161 21 32 42 53 6
21120
In the first test case, there are two arrays that satisfy the condition: $$$p_1 = \{2, 3\}, p_2 = \{3, 2\}$$$, which means TN can color the vertex $$$2$$$ at first and then color the vertex $$$3$$$, or he can color the vertex $$$3$$$ at first and then color the vertex $$$2$$$.
![]() | ![]() | ![]() |
| Case 1 | Case 2 | Case 3 |
In the second test case, it can be shown that only one array satisfies the condition: $$$p=\{2,3,4\}$$$, which means TN can color the vertex $$$2$$$ at first, then color the vertex $$$3$$$, and at last, color the vertex $$$4$$$.
In the third test case, note that the empty array is also Valid.
Case 4