A Young diagram is a finite set of cells, arranged in left-aligned rows, with the row lengths in non-increasing order. It can be uniquely represented by an unordered integer partition $$$\lambda=(\lambda_1,\lambda_2,\ldots,\lambda_r)$$$ satisfying $$$\lambda_1\ge\lambda_2\ge\cdots\ge\lambda_r\ge 1$$$, where $$$r$$$ corresponds to the number of rows of the Young diagram, and $$$\lambda_i$$$ corresponds to the number of cells in the $$$i$$$-th row for $$$i = 1,2,\ldots,r$$$.
The conjugate of a Young diagram $$$\lambda$$$ is another Young diagram obtained by transposing rows and columns, represented by the conjugate partition $$$\lambda^T$$$. More specifically, if $$$\lambda$$$ has $$$c=\lambda_1$$$ columns, then $$$\lambda^T=(\mu_1,\mu_2,\ldots,\mu_c)$$$ where $$$\mu_j=\lvert\{\,i:\lambda_i\ge j\,\}\rvert$$$ for $$$j = 1,2,\ldots,c$$$.
For a cell at the $$$i$$$-th row and the $$$j$$$-th column that belongs to $$$\lambda$$$, let the subdiagram anchored at $$$(i,j)$$$ be the set of all cells $$$(x,y)$$$ of $$$\lambda$$$ with $$$x\ge i$$$ and $$$y\ge j$$$. It is easy to see that, this set is itself a Young diagram when viewed with $$$(i,j)$$$ as its top-left corner.
Define the cuteness of a Young diagram $$$\lambda$$$ as the number of distinct Young diagrams that can be obtained from $$$\lambda$$$ by performing the following operation any number (possibly zero) of times: choose any cell $$$(i,j)$$$ of the current Young diagram, take the subdiagram anchored at $$$(i,j)$$$, and replace it with its conjugate anchored at the same position. The operation is allowed if and only if the overall set of cells still forms a valid Young diagram; otherwise the operation is denied and undone, as illustrated below.
You are given a non-increasing sequence of positive integers $$$a_1,a_2,\ldots,a_n$$$. For each $$$i = 1,2,\ldots,n$$$, compute the cuteness of the Young diagram $$$\lambda^{(i)}$$$, modulo $$$998\,244\,353$$$, where $$$\lambda^{(i)}=(a_1,a_2,\ldots,a_i)$$$.
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^6$$$), denoting the length of the given sequence.
The second line contains $$$n$$$ integers $$$a_1,a_2,\dots,a_n$$$ ($$$1 \le a_i \le n$$$). It is guaranteed that $$$a_1 \ge a_2 \ge \cdots \ge a_n$$$.
Output $$$n$$$ integers separated by spaces, where the $$$i$$$-th integer represents the cuteness of the Young diagram $$$\lambda^{(i)}$$$, modulo $$$998\,244\,353$$$.
33 2 1
2 3 1
For the sample case: