Solutions of Cubic Equation#6241

Solutions of Cubic Equation

2 seconds
128 megabytes
Hard

Hannah asked you to determine all distinct real solutions of a cubic equation of the following form:

Ax^3 + Bx^2 + Cx + D = 0

This task can be quite complicated, especially if one of the solutions is irrational. Before you start to complain, Hannah assures you that she will only give you cubic equations with at least one integer solution.

Your task is to find all distinct real solutions of the cubic equation, given the coefficients , , , and , where A \ne 0. The coefficients , , , and can be any real numbers between and , inclusive. The range of possible values for is to .

Input

The first line contains an integer (0 < N < 100), the number of test cases. Each of the following lines contains four real numbers , , , and , with A \ne 0.

Output

For each test case, print all distinct real solutions of the cubic equation in a single line, sorted in increasing order. Each real solution must be rounded to the nearest ten-thousandth and printed with exactly four digits after the decimal point. If there are multiple solutions, separate them with exactly one space.

Examples

Example 1

Loading
Loading