12837: 【验证型】第11章:指针和数组 2^? mod = 1

Memory Limit:20 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:1 Solved:0

Description

给你一个正整数n,要求你找到最小的x(x>0)满足2^x mod n = 1。

Input

第一行输入N,表示测试数据的组数,接下来N行输入测试数据n。

Output

如果最小的x存在,则输出2^x mod n = 1(注意x和n要用具体的值代替),否则输出2^? mod n = 1,若x > 99998也只需输出 2^? mod n = 1。

Sample Input Copy

2
2
5

Sample Output Copy

2^? mod 2 = 1
2^4 mod 5 = 1