Solutions of Cubic Equation
Hannah asked you to determine all distinct real solutions of a cubic equation in the following form:
Ax^3 + Bx^2 + Cx + D = 0
The task is quite complicated especially if one solution is irrational. Before you complained, Hannah told you that she'll only give cubic equations with at least one integer solution.
Your task then is to find all distinct real solutions of the cubic equation given the coefficients A, B, C, and D where A is not 0.
The range of values of A, B, C, and D is -2000000 to 2000000. The range of values of x is -1000000 to 1000000.
Input
The input starts with an integer N (where 0 < N < 100). It is then followed by N input lines. Each input line consists of four numbers A, B, C, and D, not necessarily integers. A is never 0.
Output
For each input line, print all distinct real solutions of the cubic equation in one line, sorted in increasing order. Each real solution must be rounded off to the nearest ten thousandth and must be printed with exactly four digits after the decimal point. Two or more distinct real solutions must be separated by exactly one space.