Number Game

No attempts yetTime limit1sMemory limit128 MB

Problem

Christine and Matt play a game they invented, the Number Game. The rules are as follows.

The players alternate turns, each choosing an integer greater than $1$. Christine moves first, then Matt, then Christine, and so on. Every number chosen so far restricts the numbers that may still be chosen:

  • A number that either player has already chosen, or any multiple of such a number, may not be chosen.
  • Any sum of such multiples may not be chosen either.

In other words, once a set of numbers has been chosen, every non-negative integer combination of them (with at least one positive coefficient) becomes forbidden. A player who cannot choose any new number loses.

Example. Christine starts with $4$, which forbids $4, 8, 12, \dots$. Matt answers with $3$, which additionally forbids $3, 6, 9, \dots$ as well as sums such as $7 = 3 + 4$, $10 = 2 \cdot 3 + 4$, $11 = 3 + 2 \cdot 4$, $13 = 3 \cdot 3 + 4$, and so on. The only numbers still available are $2$ and $5$. Christine now chooses $2$; since $5 = 2 + 3$ becomes forbidden, no number is left for Matt, so Christine wins.

After enough moves the set of remaining choices becomes finite. Given a position (the list of numbers that are not yet forbidden), output every winning move.

A winning move is a move after which the mover can force a win no matter how the opponent replies. Formally:

  • A winning move is a move that leaves the opponent in a losing position.
  • A winning position is a position in which a winning move exists; a losing position is a position in which no winning move exists.
  • The position in which every number is forbidden is a losing position (the player to move there loses).

Input

The input contains several test cases, one position per line. Each line begins with an integer $n$ ($1 \le n \le 20$), the count of numbers that are still available, followed by those $n$ numbers $a_1, \dots, a_n$ ($2 \le a_i \le 20$). Every position given can actually arise in the game (for example, if $3$ is not available then $6$ is not available either). The input ends with a line containing a single $0$, which must not be processed.

Output

For the $m$-th test case ($m$ starting at $1$), first print Test Case #m. On the next line print There's no winning move. if the position has no winning move, or The winning moves are: w1 w2 ... wk listing all winning moves in increasing order ($w_i < w_{i+1}$). Print one blank line between consecutive test cases.