Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. 
Zombies zombies everywhere!! 
In a parallel world of zombies, there are N zombies. There are infinite number of unused cars, each of same model only differentiated by the their colors. The cars are of K colors.

A zombie parent can give birth to any number of zombie-children (possibly zero), i.e. each zombie will have its parent except the head zombie which was born in the winters by combination of ice and fire.

Now, zombies are having great difficulties to commute to their offices without cars, so they decided to use the cars available. Every zombie will need only one car. Head zombie called a meeting regarding this, in which he will allow each zombie to select a car for him.

Out of all the cars, the head zombie chose one of cars for him. Now, he called his children to choose the cars for them. After that they called their children and so on till each of the zombie had a car. Head zombie knew that it won't be a good idea to allow children to have cars of same color as that of parent, as they might mistakenly use that. So, he enforced this rule during the selection of cars.

Professor James Moriarty is a criminal mastermind and has trapped Watson again in the zombie world. Sherlock somehow manages to go there and met the head zombie. Head zombie told Sherlock that they will let Watson free if and only if Sherlock manages to tell him the maximum number of ways in which the cars can be selected by N Zombies among all possible hierarchies. A hierarchy represents parent-child relationships among the N zombies. Since the answer may be large, output the answer modulo 10^{9} + 7. Sherlock can not compute big numbers, so he confides you to solve this for him.

------ Input ------ 

The first line consists of a single integer T, the number of test-cases.

Each test case consists of two space-separated integers N and K, denoting number of zombies and the possible number of colors of the cars respectively.

------ Output ------ 

For each test-case, output a single line denoting the answer of the problem.

------ Constraints ------ 

$1 ≤ T ≤ 100$
$1 ≤ N ≤ 10^{9}$
$1 ≤ K ≤ 10^{9}$

------ Subtasks ------ 

Subtask #1 : (10 points)

1 ≤ T ≤ 20
1 ≤ N, K ≤ 10

Subtask 2 : (20 points) 

1 ≤ T ≤ 10
1 ≤ N, K ≤ 10000

Subtask 3 : (70 points) 

1 ≤ T ≤ 100
1 ≤ N, K ≤ 10^{9}

----- Sample Input 1 ------ 
2
2 2
3 3
----- Sample Output 1 ------ 
2
12