Counting Graphs

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

Bessie has a connected, undirected graph GG with NN vertices labeled 1N1\ldots N and MM edges (2N102,N1MN2+N22\le N\le 10^2, N-1\le M\le \frac{N^2+N}{2}). GG may contain self-loops (edges from nodes back to themselves), but no parallel edges (multiple edges connecting the same endpoints).

Let f_G(a,b)f\_G(a,b) be a boolean function that evaluates to true if there exists a path from vertex 11 to vertex aa that traverses exactly bb edges for each 1aN1\le a\le N and 0b0\le b, and false otherwise. If an edge is traversed multiple times, it is included that many times in the count.

Elsie wants to copy Bessie. In particular, she wants to construct an undirected graph GG' such that f_G(a,b)=f_G(a,b)f\_{G'}(a,b)=f\_G(a,b) for all aa and bb.

Your job is to count the number of distinct graphs GG' that Elsie may create, modulo 109+710^9+7. As with GG, GG' may contain self-loops but no parallel edges (meaning that there are 2N2+N22^{\frac{N^2+N}{2}} distinct graphs on NN labeled vertices in total).

Each input contains TT (1T10541\le T\le \frac{10^5}{4}) test cases that should be solved independently. It is guaranteed that the sum of N2N^2 over all test cases does not exceed 10510^5.

입력

The first line of the input contains TT, the number of test cases.

The first line of each test case contains the integers NN and MM.

The next MM lines of each test case each contain two integers xx and yy (1xyN1\le x\le y\le N), denoting that there exists an edge between xx and yy in GG.

Consecutive test cases are separated by newlines for readability.

출력

For each test case, the number of distinct GG' modulo 109+710^9+7 on a new line.