Card games for a single player are called patience in Britain and solitaire in the United States. One notoriously difficult solitaire game is called Two-Stacks and uses the following layout and rules.
push x moves the topmost card of the stock pile onto intermediate pile $x$ (where $x$ is $1$ or $2$); a pop x moves the topmost card of intermediate pile $x$ onto the foundation pile.Your grandmother has just learned the game and, for each deal she tries, wants to know whether it can be won at all. Write a program that decides this for her.
The input contains several test cases. The first line of a test case has a single integer $N$ ($1 \le N \le 208$), the number of cards in the game. The second line has $N$ integers between $1$ and $52$, separated by single spaces, listing the cards in dealing order; the topmost card of the stock pile is therefore the $N$-th number on the line. Each value from $1$ to $52$ appears at most four times in a test case. The input ends with a test case where $N = 0$, which must not be processed.
For each test case, first print a line with its identifier in the form #i, where $i$ starts at $1$ and increases by one for every test case. Then print a single line: possible if the deal can be won (every card can be moved onto the foundation pile in non-decreasing order using the two intermediate piles), or impossible otherwise.