Konajya is learning how to factor polynomials. Her homework assignment consists of polynomials which she must factor. The -th polynomial has degree . Each polynomial is described by a sequence of integers which are the coefficients of the polynomial (i.e. would be given in the format of
1 3 9). Luckily, you know that each polynomial only has real integer roots. Because she is too lazy to factor them by herself, she decided to give this problem to you, so you can do it for her!
All roots are integers whose absolute value is less than or equal to .
The polynomial evaluated at where will always yield an absolute value less than .
Subtask 1 [5%]
Subtask 2 [10%]
Subtask 3 [25%]
Subtask 4 [60%]
No additional constraints
On the first line, there is one integer, , the number of polynomials to follow.
The next lines contain an integer representing the degree of the polynomial, followed by space-separated integers, the coefficients of the polynomial starting from the highest degree to the lowest degree.
Output a total of lines. Line should contain the roots of the -th polynomial in the input in increasing order. It is guaranteed that the polynomial has integer roots. You are to print the multiple roots.
3 2 2 -6 4 2 1 6 9 2 1 0 -9
1 2 -3 -3 -3 3