#P9145. ShuanQ
ShuanQ
Source: Super League of Chinese College Students Algorithm Design 2022, Contest 2 by HDU.
Problem Description
CX is a programmer of a mooc company. A few days ago, he took the blame for leakage of users' data. As a result, he has to develop an encryption algorithm, here is his genius idea.
First, the protocol specifies a prime modulus , then the server generates a private key , and sends the client a public key . Here .
Encryption formula:
Decryption formula:
It do make sense, however, as a master of number theory, you are going to decrypt it.You have intercepted information about , and keeps unknown. If you can decrypt it, output , else, say shuanQ
to CX.
Input
First line has one integer , indicating there are test cases. In each case:
One line has three integers . ()
It's guaranteed that .
Output
In each case, print an integer , or a string shuanQ
.
Sample
2
5 5 5
6 6 6
shuanQ
1