#P1093D. Beautiful Graph

    ID: 4548 Type: RemoteJudge 2000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>dfs and similargraphs*1700

Beautiful Graph

No submission language available for this problem.

Description

You are given an undirected unweighted graph consisting of nn vertices and mm edges.

You have to write a number on each vertex of the graph. Each number should be 11, 22 or 33. The graph becomes beautiful if for each edge the sum of numbers on vertices connected by this edge is odd.

Calculate the number of possible ways to write numbers 11, 22 and 33 on vertices so the graph becomes beautiful. Since this number may be large, print it modulo 998244353998244353.

Note that you have to write exactly one number on each vertex.

The graph does not have any self-loops or multiple edges.

The first line contains one integer tt (1t31051 \le t \le 3 \cdot 10^5) — the number of tests in the input.

The first line of each test contains two integers nn and mm (1n3105,0m31051 \le n \le 3 \cdot 10^5, 0 \le m \le 3 \cdot 10^5) — the number of vertices and the number of edges, respectively. Next mm lines describe edges: ii-th line contains two integers uiu_i, vi v_i (1ui,vin;uivi1 \le u_i, v_i \le n; u_i \neq v_i) — indices of vertices connected by ii-th edge.

It is guaranteed that i=1tn3105\sum\limits_{i=1}^{t} n \le 3 \cdot 10^5 and i=1tm3105\sum\limits_{i=1}^{t} m \le 3 \cdot 10^5.

For each test print one line, containing one integer — the number of possible ways to write numbers 11, 22, 33 on the vertices of given graph so it becomes beautiful. Since answers may be large, print them modulo 998244353998244353.

Input

The first line contains one integer tt (1t31051 \le t \le 3 \cdot 10^5) — the number of tests in the input.

The first line of each test contains two integers nn and mm (1n3105,0m31051 \le n \le 3 \cdot 10^5, 0 \le m \le 3 \cdot 10^5) — the number of vertices and the number of edges, respectively. Next mm lines describe edges: ii-th line contains two integers uiu_i, vi v_i (1ui,vin;uivi1 \le u_i, v_i \le n; u_i \neq v_i) — indices of vertices connected by ii-th edge.

It is guaranteed that i=1tn3105\sum\limits_{i=1}^{t} n \le 3 \cdot 10^5 and i=1tm3105\sum\limits_{i=1}^{t} m \le 3 \cdot 10^5.

Output

For each test print one line, containing one integer — the number of possible ways to write numbers 11, 22, 33 on the vertices of given graph so it becomes beautiful. Since answers may be large, print them modulo 998244353998244353.

Samples

Sample Input 1

2
2 1
1 2
4 6
1 2
1 3
1 4
2 3
2 4
3 4

Sample Output 1

4
0

Note

Possible ways to distribute numbers in the first test:

  1. the vertex 11 should contain 11, and 22 should contain 22;
  2. the vertex 11 should contain 33, and 22 should contain 22;
  3. the vertex 11 should contain 22, and 22 should contain 11;
  4. the vertex 11 should contain 22, and 22 should contain 33.

In the second test there is no way to distribute numbers.