There are a total of n people in Prateek's class, numbered from 1 to n.
Every person has some field of interest for their projects. 
There are a number people who have the same field of interest.
Now, you are given a number of pairs of the form (x,y). 
This means that the students numbered x and y have interest in the same field. 
You task is to form groups, such that, all the people with the same field of interest are in the same group.
No, member can be a member of more than one group.
From each group, the proctor picks exactly two students and if the group has only one student, then, only one student is picked.
These students will be responsible for submitting the progress report to the mentor.
Calculate the number of ways in which these students can be picked. As the answer can be large, print it modulo 1000000007

NOTE: These pairs are transitive, and symmetric.

INPUT 
The first line of input contains the number of test cases. Description of a test case is given below.
1.The first line of each test case contains two space separated integers n and k, 
the number of people and the number of pairs, respectively.

2.Then k lines follow, each containing 2 space separated integers x and y. 
This means that people numbered x and y have interest in the same field.

OUTPUT
The output t lines, one for each test case. Each line contains the required answer for that test case.

CONSTRAINTS
1 ≤ t ≤ 5
1 ≤ n,k ≤ 100000
1 ≤ x,y ≤ n

SAMPLE INPUT
1
6 4
1 2
2 3
4 5
2 6

SAMPLE OUTPUT
6
def dfs(v):
    global mark,c_c
    q=[]
    q.append(v)
    s=0
    while q:
        top=q.pop()
        #s=1
        mark[top]=c_c
        for j in G[top]:
            if mark[j]==-1:
                q.append(j)
                s+=1
                mark[j]=mark[top]
    d[c_c]=s
                
t=input()
mo=10**9+7
while t!=0:
    n,m=map(int,raw_input().split())
    G=[[] for i in xrange(n+1)]
    for k in xrange(m):
        x,y=map(int,raw_input().split())
        G[x].append(y)
        G[y].append(x)
   
    mark=[-1]*(n+1)
    d={}#dictinary containg component_ids and their size.
    c_c=1
    for v in xrange(1,n+1):
       
        if G[v]:#in-case all vertices from(,n) are not a part of the graph.
            if mark[v]==-1:
             dfs(v)
             c_c+=1
    n_t=1
    #print d
    for i in d:
        d[i]+=1
    	if d[i]==1:
    		n_t*=1
    	else:
            #print d[i]
            sd=((d[i])*(d[i]-1))/2
            sd=sd%mo
            n_t%=mo
            n_t*=sd
    print n_t%mo
    t-=1