When Sergeant Argus's army assembles for drilling, they stand in the shape of an
Argus believes that it is important to keep an eye on all of his soldiers at all times. Since he likes to look at the grid from the upper left, he requires that:
- Within every row of the grid, the soldiers' heights must be in strictly increasing order, from left to right.
- Within every column of the grid, the soldiers' heights must be in strictly increasing order, from top to bottom.
Although no two soldiers in the same row or column may have the same height, it is possible for multiple soldiers in the grid to have the same height.
Since soldiers sometimes train separately with their row or their column, Argus has asked you to make a report consisting of
You know that Argus will make you do hundreds of push-ups if you give him an incomplete report. Can you figure out what the missing list is?
Input Specification
The first line of the input gives the number of test cases,
Output Specification
For each test case, output one line containing Case #x: y
, where
Limits
Time limit: 20 seconds per test set.
Memory limit: 1 GB.
The integers on each line will be in strictly increasing order.
It is guaranteed that a unique valid answer exists.
Small Dataset
Large Dataset
Sample Input
1
3
1 2 3
2 3 5
3 5 6
2 3 4
1 2 3
Sample Output
Case #1: 3 4 6
In the sample case, the arrangement must be either this:
1 2 3
2 3 4
3 5 6
or this:
1 2 3
2 3 5
3 4 6
In either case, the missing list is 3 4 6
.
Comments