The number x is called an idempotent modulo n if
Write the program to find all idempotents modulo n, where n is a product of two distinct primes p and q.
First line contains the number K of test cases to consider (1 ≤ K ≤ 1000). Each of the following K lines contains one number n < 109.
Write to the K-th line all idempotents of K-th test case in increasing order. Only nonnegative solutions bounded by n should be printed.
0 1 3 4
0 1 6 10
0 1 303395437 606790875
Problem Author: Pavel Atnashev
Problem Source: USU Internal Contest, March 2002