SP8064 AMR10J - Mixing Chemicals
Description
There are N bottles each having a different chemical. For each chemical i, you have determined C\[i\] which means that mixing chemicals i and C\[i\] causes an explosion. You have K distinct boxes. In how many ways can you divide the N chemicals into those boxes such that no two chemicals in the same box can cause an explosion together?
**INPUT**
The first line of input is the number of test cases T. T test cases follow each containing 2 lines.
The first line of each test case contains 2 integers N and K.
The second line of each test case contains N integers, the ith integer denoting the value C\[i\]. The chemicals are numbered from 0 to N-1.
**OUTPUT**
For each testcase, output the number of ways modulo 1,000,000,007.
**CONSTRAINTS**
T
Input Format
N/A
Output Format
N/A