Missing Numbers

 Alice (uniformly and independently) randomly picks two integers 

from the range , and writes down the values of , , and (integer division) in some random order. Unfortunately, she forgot the values of and . You need to help her to find out if there exists two integers such that and , , ,

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
, denoting the number of testcases. The description of
  • testcases follows.
  • Each testcase consists of a single line of input, containing four space-separated integers
  • — the values written down by Alice. It is guaranteed that at most one of the four numbers
    • 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
    and , print and not ). If there does not exist any such choice of integers, print
    • twice, separated by a space, instead.

    Constraints

  • At most one of
    • 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

    Test case

    : With we obtain which are exactly the

    numbers written down by Alice.

    Test case

    : It can be shown that no choice of integers can produce the given numbers.
    Previous
    Next Post »