Score : $500$ points
You are given an integer $N$ greater than or equal to $2$ and a prime $P$.
Consider the graph $G$ with $2N$ vertices and $(3N-2)$ edges shown in the figure below.
More specifically, the edges connect the vertices as follows, where the vertices are labeled as Vertex $1$, Vertex $2$, $\ldots$, Vertex $2N$, and the edges are labeled as Edge $1$, Edge $2$, $\ldots$, Edge $(3N-2)$.
For each $i=1,2,\ldots ,N-1$, solve the following problem.
Find the number of ways, modulo $P$, to remove exactly $i$ of the $3N-2$ edges of $G$ so that the resulting graph is still connected.
Input is given from Standard Input in the following format:
$N$ $P$
Print $N-1$ integers, the $i$-th of which is the answer for $i=k$, separated by spaces.
3 998244353
7 15
In the case $N=3$, there are $7$ ways, shown below, to remove exactly one edge so that the resulting graph is still connected.
There are $15$ ways, shown below, to remove exactly two edges so that the resulting graph is still connected.
Thus, these numbers modulo $P=998244353$ should be printed: $7$ and $15$, in this order.
16 999999937
46 1016 14288 143044 1079816 6349672 29622112 110569766 330377828 784245480 453609503 38603306 44981526 314279703 408855776
Be sure to print the numbers modulo $P$.