Many people are familiar with the standard 3-ball juggling pattern: throw ball A, then ball B, then ball C, then A again, then B, then C, and so on. Assuming a steady rhythm of throws, a ball thrown higher into the air takes longer to come back down, so more time passes before it is thrown again. We say that a ball thrown to height $h$ is not thrown again until exactly $h$ steps later in the pattern. In the standard 3-ball pattern every ball is thrown to height 3 and is therefore thrown again 3 steps later: ball A, thrown at time 1, is next thrown at time 4.
By convention we label the first ball thrown as A, and each time a new ball enters the pattern we give it the next uppercase letter (so B and then C in the classic pattern).
Jugglers describe more complex patterns with a repeating sequence of numbers giving the height of each successive throw. This is called siteswap notation.
Consider the siteswap pattern "3 4 5". It describes the infinite sequence of throw heights "3 4 5 3 4 5 3 4 5 ...": the first throw has height 3, the second height 4, the third height 5, the fourth height 3 (the pattern repeats), and so on.
Although the siteswap gives the throw heights, the motion of the individual balls is less obvious. Let us trace the start of the "3 4 5" pattern.
The first throw is ball A at height 3, so A is not thrown again until time 4. At time 2 we must throw with height 4; since A has not yet returned, we introduce a second ball B. Because B is thrown at time 2 with height 4, it is next thrown at time 6. At time 3 we introduce a third ball C and throw it to height 5 (so it is next thrown at time 8). The next throw, at time 4, has height 3; but A has now returned (from its throw at time 1), so instead of a new ball we throw A. At time 5 we must throw with height 4, yet balls A, B, and C are all still in the air, so we introduce a new ball D. (D is the last ball introduced for this pattern.) The juggling continues with B thrown to height 5 at time 6, and so on.
The "3 4 5" pattern works out nicely. It is a 4-ball pattern, because once ball D has entered the juggler can keep going until their arms get tired. Unfortunately, not every siteswap sequence is legitimate!
Now consider trying the siteswap "3 5 4". For the first six throws everything is fine, but a problem arises at time 7. Ball B was thrown at time 2 with height 5, so it wants its next turn at time 7. But ball C was thrown at time 3 with height 4, so it also wants its next turn at time 7. (Worse still, ball A was thrown at time 4 with height 3, so it too wants time 7.) Several balls demand to be thrown at the same instant, and everything comes crashing to the ground.
Each line describes a separate trial. It begins with an integer $1 \le P \le 7$, the period of the repeating pattern, followed by $P$ positive integers giving the throw heights of the pattern. Every individual throw height is at most 19. The input ends with a line containing a single 0.
For each pattern, print a single line listing the balls used by the first 20 throws, in order, if all 20 throws can be made legally. Otherwise print the word CRASH. You do not need to worry about crashes caused by balls that land strictly after time 20.