Square root#3709

Square root

1 second
256 megabytes
Medium

A number is considered a square root of a number modulo if and only if x^2 \equiv a \pmod{n}. Your task is to write a program that identifies all square roots of the number modulo .

Input

The first line contains a single integer (1 \leq t \leq 100000) — the number of test cases. Each of the following lines describes a separate test case with two integers and (1 \leq a, n \leq 32767), where is a prime number, and and are coprime.

Output

For each test case, output all square roots of in the range 0 \leq x \leq n-1 in ascending order, separated by a single space on one line. If no square roots exist for the given test case, print No root on a separate line.

Examples

Example 1

Loading
Loading