=====
=====
=====
You are given the dimensions (width and length) of the mat on which the class takes place. For every student, there is a circular area she has to have for herself, with radius equal to the reach of her arms. These circles can not intersect, though they can touch; and the center of each circle (where the student stands) has to be on the mat. Note that the arms can reach outside the mat. You know that there's plenty of space on the mat — the area of the mat is at least five times larger than the total area of the circles required by all the people in the class. It will always be possible for all the people to position themselves as required.
The first line of the input gives the number of test cases, T. T test cases follow. Each test case consists of two lines. The first line contains three integers: N, W and L, denoting the number of students, the width of the mat, and the length of the mat, respectively. The second line contains N integers ri, denoting the reach of the arms of the ith student.
For each test case, output one line containing "Case #n: y", where n is the case number (starting from 1) and y is a string containing 2N numbers, each of which can be an integer or a real number: x1, y1, x2, y2, etc., where the pair (xi, yi) is the position where the ithstudent should stand (with 0 ≤ xi ≤ W and 0 ≤ yi ≤ L).
As there will likely be multiple ways to position the students on the mat, you may output any correct positioning; but remember that you may not submit an output file more than 200kB in size.
1 ≤ T ≤ 50.
1 ≤ W, L ≤ 109.
1 ≤ ri ≤ 105.
The area of the mat is at least 5 times larger than the total area of the circles:
5*π*(r12 + ... + rN2) ≤ W*L.
1 ≤ N ≤ 10.
1 ≤ N ≤ 103.
The total number of circles in all test cases will be ≤ 6000.
To be precise, when we say that peak B looks like it's the highest from peak A we mean that B is further down the road than A; all peaks between A and B are below the line connecting the peaks A and B; and all the peaks that are further than B are below or on this line.
You don't know how high each peak is, but you have a very good memory; you've been on all the peaks; and you remember which peak looks like it's the highest from each of them. You would like to invent a set of heights for the peaks that is consistent with that information. Note that you were lying down when looking, so we assume you always looked from the ground level on each peak.
In this example, the fourth peak looks like it's the highest from the first and third peaks. When you're lying on the second peak, you can't see the fourth peak; the third one obscures it, and looks like it's the highest.
The first line of the input gives the number of test cases, T. T test cases follow. Each test case consists of two lines. The first contains one number, N, the number of peaks in the range. You began your trip on peak 1 and went forward to peak N. The next line contains N-1 numbers xi. The i-th number denotes the index of the peak that appeared to be the highest from peak i (note that peak N is the last peak, so there are no other peaks to see from there).
For each test case, output one line containing "Case #n: y1 y2 ... yN", where n is the case number (starting from 1) and yi is the height of the i-th peak. You can output any solution agreeing with the input data, except that all the heights you output have to be integers between 0 and 109, inclusive.
If no solution is possible, output "Case #n: Impossible" instead.
1 ≤ T ≤ 30.
i < xi ≤ N.
2 ≤ N ≤ 10.
2 ≤ N ≤ 2000.
The good news is you have already memorized the layout of the mountain. It is a grid with certain squares impassable and other squares containing caves where you can rest for the night. The bad news is you don't know where you are, and it's too steep to climb up. All you can do is move left, right, or down.
Here is an example layout, with '.' representing a passable square, '#' representing an impassable square, and numbers representing caves.
###### ##...# #..#.# #...## #0#..# ####1# ######
Since it is so dark, you will move around by following a plan, which is a series of instructions, each telling you to move one square left, right, or down. If an instruction would take you to a passable square or to a cave, you will follow it. If it would take you to an impassable square, you will have to ignore it. Either way, you will continue on to the next step, and so on, until you have gone through the whole plan.
To help with your descent, you want to find out two things for each cave C:
Note that you might pass by several caves while following a plan. All that matters is what square you finish on after executing all the steps, not what caves you visit along the way.
For example, in the layout above, cave 0 is lucky. There are 9 squares that it can be reached from (including itself), and the plan "left-left-down-down-left-down" will finish with you at the cave from any of those squares.
The first line of the input gives the number of test cases, T. T test cases follow, beginning with a line containing integers R and C, representing the number of rows and columns in the mountain layout.
This is followed by R lines, each containing C characters, describing a mountain layout. As in the example above, a '#' character represents an impassable square, a '.' character represents a passable square, and the digits '0'-'9' represent caves (which are also passable squares).
For each test case, first output one line containing "Case #x:", where x is the case number (starting from 1). For each cave C, starting with 0 and counting up from there, write a line "C: nC LC". Here, C is the cave number, nC is the number of squares you can reach the cave from, and LC is either the string "Lucky" or the string "Unlucky", as defined above.
There will be between 1 and 10 caves inclusive.
If there are d caves, they will be labeled with the digits {0, 1, ..., d - 1}, and no two caves will have the same label.
All squares on the boundary of the mountain layout will be impassable.
1 ≤ T ≤ 20.
3 ≤ R, C ≤ 10.
3 ≤ R, C ≤ 60.