8494: ShuanQ

内存限制:128 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:1 通过:1

题目描述

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 Q . Here .Q = P^-1 ,P ×Q ≡ 1 mod M
Encryption formula:e = r * P mod M
Decryption formula:r = e *    Q mod M
It do make sense, however, as a master of number theory, you are going to decrypt it.You have
intercepted information about P , Q , and M keeps unknown. If you can decrypt it,
output r, else, say "shuanQ" to CX.

输入格式

First line has one integer T , indicating there are T test cases. In each case:
One line has three integers . ( P,Q,e)
It's guaranteed that

输出格式

In each case, print an integer r, or a string "shuanQ".

输入样例 复制

2
5 5 5
6 6 6

输出样例 复制

shuanQ
1