View as PDF

Points: 7 (partial)
Time limit: 0.6s
Python 1.8s
Memory limit: 64M

Authors:
Problem types
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

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!

#### Constraints

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 .

#### Input Specification

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 Specification

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.

#### Sample Input

3
2 2 -6 4
2 1 6 9
2 1 0 -9

#### Sample Output

1 2
-3 -3
-3 3