eolymp
bolt
Try our new interface for solving problems
Problems

Interesting equation

Interesting equation

Time limit 5 seconds
Memory limit 64 MiB

Little Y finds there is a very interesting formula in mathematics:

X^Y mod Z = K

Given X, Y, Z, we all know how to figure out K fast. However, given X, Z, K, could you figure out Y fast?

Input data

Input data consists of no more than 20 test cases. For each test case, there would be only one line containing 3 integers X, Z, K (0X, Z, K10^9).

Output data

For each test case output one line. Write "No Solution" (without quotes) if you cannot find a feasible Y (0Y < Z). Otherwise output the minimum Y you find.

Examples

Input example #1
2
5 58 33
2 4 3
Output example #1
9
No Solution
Source POJ Monthly - 2007.07.08, Guo, Huayang