Problems
Your friend Charles gives you a challenge. He puts
Charles then asks you to write a positive integer on each card without altering his chosen order such that:
- The integers you write appear in non-decreasing order when cards are read from left to right.
- Cards of the same color have the same integer written on them.
- Cards of different colors have different integers written on them.
Finally, Charles wants you to order the colors in increasing order of written integer.
For example, if blue cards have a
Input
The first line of the input gives the number of test cases,
Each test case begins with a line containing the integer
Output
For each test case, output one line containing
Case #, where IMPOSSIBLE instead.
Example
2
4
3 8 8 2
5
3 8 2 2 8
Case #1: 3 8 2
Case #2: IMPOSSIBLE