atcoder#ABC253H. [ABC253Ex] We Love Forest

[ABC253Ex] We Love Forest

Score : 600600 points

Problem Statement

We have a graph GG with NN vertices numbered 11 through NN and 00 edges. You are given sequences u=(u1,u2,,uM),v=(v1,v2,,vM)u=(u_1,u_2,\ldots,u_M),v=(v_1,v_2,\ldots,v_M) of length MM.

You will perform the following operation (N1)(N-1) times.

  • Choose ii (1iM)(1 \leq i \leq M) uniformly at random. Add to GG an undirected edge connecting Vertices uiu_i and viv_i.

Note that the operation above will add a new edge connecting Vertices uiu_i and viv_i even if GG already has one or more edges between them. In other words, the resulting GG may contain multiple edges.

For each K=1,2,,N1K=1,2,\ldots,N-1, find the probability, modulo 998244353998244353, that GG is a forest after the KK-th operation.

What is a forest?

An undirected graph without a cycle is called a forest. A forest is not necessarily connected.

Definition of probability modulo $998244353$

We can prove that the sought probability is always a rational number. Moreover, under the Constraints of this problem, it is guaranteed that, when the sought probability is represented by an irreducible fraction yx\frac{y}{x}, xx is indivisible by 998244353998244353.

Then, we can uniquely determine an integer zz between 00 and 998244352998244352 (inclusive) such that xzy(mod998244353)xz \equiv y \pmod{998244353}. Print this zz.

Constraints

  • 2N142 \leq N \leq 14
  • N1M500N-1 \leq M \leq 500
  • 1ui,viN1 \leq u_i,v_i \leq N
  • uiviu_i\neq v_i
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM

u1u_1 v1v_1

\vdots

uMu_M vMv_M

Output

Print N1N-1 lines. The ii-th line should contain the probability, modulo 998244353998244353, that GG is a forest after the ii-th operation.

3 2
1 2
2 3
1
499122177

Let us denote by (u,v)(u, v) the edge connecting Vertices uu and vv.

After the 11-st operation, GG will have:

  • Edge (1,2)(1, 2) with a probability of 1/21/2;
  • Edge (2,3)(2, 3) with a probability of 1/21/2.

In both cases, GG is a forest, so the answer for K=1K=1 is 11.

After the 22-nd operation, GG will have:

  • Edges (1,2)(1, 2) and (1,2)(1, 2) with a probability of 1/41/4;
  • Edges (2,3)(2, 3) and (2,3)(2, 3) with a probability of 1/41/4;
  • Edges (1,2)(1, 2) and (2,3)(2, 3) with a probability of 1/21/2.

GG is a forest only when GG has Edges (1,2)(1, 2) and (2,3)(2, 3). Therefore, the sought probability is 1/21/2; when represented modulo 998244353998244353, it is 499122177499122177, which should be printed.

4 5
1 2
1 2
1 4
2 3
2 4
1
758665709
918384805