시간 제한메모리 제한제출정답맞힌 사람정답 비율
8 초 1024 MB245526.316%

문제

This problem is about the special case of the Satisfiability Problem (SAT). Let's introduce the definition of SAT first.

A SAT instance is a boolean logic formula consisting of several boolean variables combined by AND, OR, and NOT operators and parentheses. An assignment is a mapping from variable to boolean value. An assignment is satisfying a formula if and only if the formula is evaluated to be true with the given assignment. A literal is either a variable or its negation. A clause is a list of literals concatenated with OR. A formula is in Conjunctive Normal Form (CNF) if it consists of clauses concatenated with AND. In the following, we only consider CNF formulae as SAT inputs because every formula can be converted to the equivalent CNF formula. 2-SAT is a special case of SAT where the length of clauses are limited to 2. For example, $(x ∨ y) ∧ (¬x ∨ z)$ is a 2-SAT instance consisting of $3$ variables and $2$ clauses. $x =$ false, $y =$ true, $z =$ true is one of the satisfying assignments for this formula.

You are given a 2-SAT instance in CNF with $N$ variables and $M$ clauses. The $i$-th variable is denoted by $x_i$ and this $i$ is called index. In all clauses, the difference between the indices of the two variables is less than or equal to $2$.

Let $C_k$ be the number of satisfying assignments where exactly $k$ variables are true. Your task is to write a program that calculates $C_k$ for all $k$s $0$ from to $N$.

Since the answer may be huge, print the answer modulo $998\,244\,353$.

입력

The input consists of a single test case with the following format.

$N$ $M$

$A_1$ $B_1$

$\vdots$

$A_M$ $B_M$

The first line consists of two integers, the number of variables $N$ ($1 ≤ N ≤ 100\,000$) and the number of clauses $M$ ($1 ≤ M ≤ 100\,000$).

The following $M$ lines represent the clauses in the 2-SAT instance. Each line corresponds to one of the clauses. These lines contain $2$ integers $A_i$ and $B_i$ representing the literals in the clause. They satisfy $1 ≤ |A_i | , |B_i | ≤ N$ and $||A_i | − |B_i || ≤ 2$ and each of them has the following meaning: If it is a positive integer $a$, the literal is $x_a$ (without negation). If it is a negative integer $b$, the literal is $¬x_{-b}$ (with negation).

출력

Output $N+1$ lines. The $i$-th line contains a single integer $C_{i-1}$ modulo $998\,244\,353$.

예제 입력 1

4 2
2 2
1 -3

예제 출력 1

0
1
2
2
1

예제 입력 2

2 4
-2 2
2 2
2 1
-1 2

예제 출력 2

0
1
1

예제 입력 3

40 10
13 -12
6 4
-19 -17
-6 4
-10 -10
16 17
32 34
-3 -2
-11 -12
37 -36

예제 출력 3

0
0
0
4
130
2052
20958
155678
896220
4160798
16004412
51999948
144776190
349181040
735692490
364558777
233997014
242620671
184707628
808271668
924963778
496489648
654440271
639886064
690035227
954668130
474278220
205649340
77168754
24784920
6715462
1505398
271728
37950
3848
252
8
0
0
0
0