Mike is learning number theory recently, and he has found a beautiful formula: .
Now given A, N, Z, can you find minimum nonnegative L that satisfies the formula?
Input
First line a integer T indicating the number of the test cases.
Next T line, each line contains three integers A, N, Z, refer to the description.
Note that Z may not be a prime
( 0 <= A , N <= 2,147,483,647 ), ( 2 <= Z <= 2,147,483,647 )
Output
For each test case output one line.
Write “No Solution” if you cannot find a feasible L(0 <= L < Z), otherwise output the minimum L you find.