Angie really enjoys studying number theory, and because she enjoys studying it so much, she created her own number theoretic function - which she aptly named the Number Theoretic Transform. She begins with two odd primes
and
(let's call their product
). She then chooses another odd number
and then computes
and
modulo
(let's call these
and
).
Lately, Angie has been having so much fun computing
and
that she lost track of her choice of
and
(which made her a bit sad). The first time this happened, she just picked new numbers and started again. However, after it kept happening throughout the day (a total of
times), she got frustrated and would now like to recover her original choices of
and
.
Given
separate instances of
,
,
, and
, can you help her recover her choice of
and
in each instance?
Constraints

(Notably,
as well)


is odd.
and
are prime.
Input Specification
The first line of input contains a single integer,
.
Then,
instances of the problem follow. Each line contains the integers
,
,
, and
for that instance.
Output Specification
For each instance, output
and
in increasing order on its own line, separated by spaces.
Sample Input
Copy
1
1073 91 452 563
Sample Output
Copy
29 37
Comments