Sly Number

Time limit1sMemory limit128 MB

Problem

A sly number is an array $A$ of $N$ integers, each taken from the set ${0, 1, 2}$. For example, $A = (1, 1, 0, 2)$ is a sly number with $A[0] = 1$, $A[1] = 1$, $A[2] = 0$, and $A[3] = 2$.

A sly number is called $ONE$ if $A[0] = 1$ and $A[i] = 0$ for every $i = 1, 2, \dots, N-1$.

For two sly numbers $A$ and $B$, the Star Multiplication $A \star B$ produces an array $C$ of length $N$ defined by

$$C[k] = \sum_{i=0}^{k} A[i]\cdot B[k-i] ;+; \sum_{i=k+1}^{N-1} A[i]\cdot B[N+k-i]$$

The result $C$ is again an array of length $N$, but it need not be a sly number (its entries may be larger than $2$). Results are reduced modulo a positive integer $Q$ entrywise:

$$(C \bmod Q)[i] = C[i] \bmod Q$$

Given a sly number $A$ and a modulus $Q$, we look for an inverse sly number $B$ — that is, a sly number $B$, whose entries are again from ${0, 1, 2}$ — such that

$$(A \star B) \bmod Q = ONE$$

For each given $A$ and $Q$, decide only whether such an inverse sly number $B$ exists.

Input

The first line contains the number $K$ of test cases. Each test case consists of two lines. The first line contains two integers separated by a space: $Q$ ($2 \le Q \le 100$) and $N$ ($5 \le N \le 50$). The second line contains the $N$ integers of the sly number $A$, each from the set ${0, 1, 2}$, separated by spaces.

Output

Print one line for each test case. If an inverse sly number exists, print A solution can be found. Otherwise, print No solution.

Hint

For the case $Q = 2$, $N = 5$, $A = (1, 0, 1, 0, 1)$, one possible inverse sly number is $B = (0, 0, 1, 1, 1)$.