We consider an integer $x$ as the $\textit{median}$ of a set $A$ containing $n$ distinct integers if it meets the following conditions:
- $x \in A$
- There are at least $\lfloor\frac{n+1}{2}\rfloor$ integers greater than or equal to $x$ in set $A$.
- There are at least $\lfloor\frac{n+1}{2}\rfloor$ integers less than or equal to $x$ in set $A$.
$\lfloor y \rfloor$ means the largest integer that does not exceed $y$. For example, if $A=\{1,3,4,5,7,9\}$, then either $4$ or $5$ is the median of set $A$.
Given a tree with $n$ nodes rooted at node $1$. Each node $u$ has an associated value $a_u$, where $a_1, a_2, \ldots, a_n$ is a permutation of $n$ (every integer from $1$ to $n$ occurs exactly once). Each node $u$ has another value $b_u$ satisfying the following condition:
- $b_u$ is the $\textit{median}$ of the set $\{ a_u \} \cup \{b_v \mid \text{node } u \text{ is the parent of node } v\}$. (The parent of node $v$ is the node directly connected to $v$ on the path to the root.)
Unfortunately, you forget some of $a_i$ and all $b_i$ except $b_1$. Now you are wondering how many different permutations $a_1,a_2,\dots,a_n$ that can match the $a_i$ and $b_1$ you remember when the tree satisfies the condition above. We consider two permutations $p_1,p_2,\dots,p_n$ and $q_1,q_2,\dots,q_n$ different if there exists an index $i$ satisfying $p_i \neq q_i$.
You are required to calculate the number of different permutations $a_1,a_2,\dots,a_n$ modulo $998244353$, for each $b_1 \in [1, n]$ respectively.