In the card game Wolf (a variant of the famous card games War and Svälta räv), two players both have a pile of cards, which together form a normal deck of playing cards. Such a deck contains $52$ cards, with each card being a unique combination of one of $4$ suits and $13$ ranks.
During a turn, each player picks the topmost card from their piles, and shows it. This process is repeated until the two cards have the same suit. Then, the player whose card had the highest rank receives all the cards that have been shown by the players during the turn (including the two that had the same suit), and these cards are shuffled into that player’s pile. The turn then ends. The turn also ends if any player, when they are supposed to pick a card from their pile, has an empty pile. A player wins if, after the end of a turn, she has cards remaining in her pile but the opposing player has no cards remaining in their pile. This means that the game is tied if neither player has cards in their pile after the end of a turn.
Your opponent is currently taking a bathroom break, so you have the opportunity to reshuffle your piles. You cannot exchange any cards, since your opponent knows the set of cards in their pile. Is it possible to reshuffle each of the two piles, so that you have won the game after the next turn?
The first line of input contains the number of cards in your hand ($0 \leq n \leq 52$). Each of the next $n$ lines contains a card specified by a number from $1$ to $13$ and one of the letters ’C’, ’D’, ’H’, ’S’, separated by a space.
The letter of a card specifies its suit (either clubs, diamonds, hearts or spades, respectively). The number of a card specifies the rank of the card. For simplicity, aces are represented as a $1$, and jacks, queens and kings are represented as the numbers $11$, $12$ and $13$. For the purpose of this problem, we consider a rank $a$ to be lower than a rank $b$ if the number of rank $a$ is lower than the number of rank $b$ (meaning aces are of the lowest rank).
Output “possible” if it is possible to reshuffle the decks, and “impossible” if it is not.
|Sample Input 1||Sample Output 1|
28 1 C 2 C 3 C 4 C 5 C 6 C 7 C 1 D 2 D 3 D 4 D 5 D 6 D 7 D 1 H 2 H 3 H 4 H 5 H 6 H 7 H 1 S 2 S 3 S 4 S 5 S 6 S 7 S
|Sample Input 2||Sample Output 2|