Play with Floor and Ceil#1565

Play with Floor and Ceil

1 Sekunde
128 Megabyte
Sehr leicht

Theorem. For any two integers and there exist two integers and such that

p \cdot \left\lfloor \frac{x}{k} \right\rfloor + q \cdot \left\lceil \frac{x}{k} \right\rceil = x

This is a fairly well-known theorem, but you are not required to prove it. Instead, we ask you to do something simpler! Given two integers and , find integers and that satisfy the given equation.

Eingabe

The first line contains the number of test cases (1 \le t \le 1000). Each of the following lines contains two positive integers and . It is guaranteed that and do not exceed 10^8.

Ausgabe

For each test case, print two integers and in one line. If there are several pairs that satisfy the equation, print any of them. It is known that p \cdot \lfloor x / k \rfloor and q \cdot \lceil x / k \rceil are -bit integers.

Beispiele

Beispiel 1

Loading
Loading