You may have seen IQ-test questions such as: find the next number in the sequence 1, 2, 3, __. Supposedly the intended answer is $16$, because the sequence lists $f(1), f(2), f(3), f(4), \dots$ for the polynomial $f(x) = 2x^3 - 12x^2 + 23x - 12$. More generally, given some information about the values of a polynomial, can you recover the polynomial? Here we restrict our attention to polynomials whose coefficients are all non-negative integers.
The first line contains an integer $n$ ($0 < n \le 10000$), the number of polynomials to identify. Each of the next $n$ lines contains two integers, the values $f(1)$ and $f(f(1))$, where $f$ is the polynomial to be found. Each of these values fits within the range of a signed two's-complement 32-bit integer.
For each polynomial, output a single line listing its coefficients separated by spaces. If the polynomial has degree $d$, list its $d+1$ coefficients in descending order of power — starting with the coefficient of $x^d$ and ending with the coefficient of $x^0$. If the polynomial is the zero polynomial, output just $0$. If no polynomial $f$ has the requested values of $f(1)$ and $f(f(1))$, output a line containing the word IMPOSSIBLE instead. If more than one polynomial $f$ has the requested values, output a line containing the word AMBIGUOUS instead.