#ABC226E. [ABC226E] Just one

[ABC226E] Just one

Score : 500500 points

Problem Statement

Given is an undirected graph with NN vertices and MM edges. The vertices are called Vertex 11, Vertex 22, \ldots, Vertex NN, and the edges are called Edge 11, Edge 22, \ldots, Edge MM. Edge ii (1iM)(1 \leq i \leq M) connects Vertex UiU_i and Vertex ViV_i. It is guaranteed that the graph is simple: it has no self-loops and no multi-edges.

There are 2M2^M ways to direct every edge in this graph. We want each vertex to have exactly one edge going from that vertex to another vertex. How many ways are there to direct the edges in that way? Since the answer may be enormous, print it modulo 998244353998244353.

Constraints

  • 2N2×1052 \leq N \leq 2\times 10^5
  • 1M2×1051 \leq M \leq 2\times 10^5
  • 1Ui,ViN1 \leq U_i,V_i \leq N
  • UiViU_i \neq V_i
  • All values in input are integers.
  • The given graph is simple.

Input

Input is given from Standard Input in the following format:

NN MM

U1U_1 V1V_1

U2U_2 V2V_2

\vdots

UMU_M VMV_M

Output

Print the answer.

3 3
1 2
1 3
2 3
2

There are two ways to direct the edges to achieve the objective:

  • 121\rightarrow 2 , 232\rightarrow 3 , 131\leftarrow 3
  • 121\leftarrow 2 , 232\leftarrow 3 , 131\rightarrow 3
2 1
1 2
0

It is obviously impossible to make every vertex have one edge going from that vertex.

7 7
1 2
2 3
3 4
4 2
5 6
6 7
7 5
4