题目描述
Alice (uniformly and independently) randomly picks two integers a, b from the range [1,10^{4}], and writes down the values of $a + b, a - b, a \cdot b$ and $\lfloor \frac{a}{b} \rfloor$ (integer division) in some random order. Unfortunately, she forgot the values of a and b. You need to help her to find out if there exists two integers a, b such that 1 ≤ a, b ≤ 10^{4} and $a + b, a - b, a \cdot b, \lfloor \frac{a}{b} \rfloor$ are the numbers she has written down.
If a solution exists, it is guaranteed to be unique.
------ Input Format ------
- The first line of input contains a single integer T, denoting the number of testcases. The description of T testcases follows.
- Each testcase consists of a single line of input, containing four space-separated integers A, B, C, D — the values written down by Alice. It is guaranteed that at most one of the four numbers A,B,C,D will be negative.
------ Output Format ------
- For each testcase, output in a single line, separated by a space, the two numbers Alice has chosen in order (i.e, if the solution is a = 1 and b = 2, print 1 \ 2 and not 2 \ 1). If there does not exist any such choice of integers, print -1 twice, separated by a space, instead.
------ Constraints ------
$1 ≤ T ≤ 10^{5}$
$-10^{9} ≤ A,B,C,D ≤ 10^{9}$
- At most one of $A, B, C, D$ is negative.
------ subtasks ------
Subtask #1 (100 points): Original constraints
----- Sample Input 1 ------
2
-1 72 0 17
1 4 5 6
----- Sample Output 1 ------
8 9
-1 -1
----- explanation 1 ------
Test case $1$: With $a = 8, b = 9$ we obtain $8 + 9 = 17, 8 - 9 = -1, 8 \cdot 9 = 72, \lfloor \frac{8}{9} \rfloor = 0$ which are exactly the $4$ numbers written down by Alice.
Test case $2$: It can be shown that no choice of integers $a, b$ can produce the given $4$ numbers.
输入格式
见题面
输出格式
见题面