Welcome to ZOJ Problem Sets Information Select Problem Runs Ranklist ZOJ Problem Set - 2608
Maps

Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge

The well known fixed point theorem states that if you take two maps of the same region that have different scales and put the smaller one atop the larger so that it is located completely within it, there is the point on the plane that represents the same actual point on both maps. Of course, there may be no common point for three or more maps - pairwise fixed points of different maps may be different.

Consider that you are given three rectangular maps M1, M2 and M3 of the same region but with different scales s1 > s2 > s3 (the scale of the map is the ratio of linear sizes of objects on the map to linear sizes of the actual objects, for any given region the larger is the scale of the map, the larger are the linear sizes of the map). Let the smallest map M3 be placed atop the largest one M1 in such a way that it is completely located within it. You have find the way to place the medium map M2, in such a way that the following conditions are satisifed:

• M2 is completely located within M1;
• M3 is completely located within M2;
• there is the point that represents the same actual place on all three maps.

Input

Input contains multiple test cases. The first line of the input is a single integer T (1 <= T <= 50) which is the number of test cases. T test cases follow, each preceded by a single blank line.

The first line of each case contains three real numbers - the scale s1 and the linear sizes x1, y1 of the largest map (1 <= x1, y1 <= 1000). Let the map be placed on the cartesian plane (with OX axis directed rightwards and OY axis directed upwards) in such a way that its corners are in the points with coordinates (0, 0), (x1, 0), (x1, y1) and (0, y1).

The second line of each case contains one real number s2 - the scale of the medium map.

The third line of each case contains nine real numbers - the scale s3 of the smallest map and the coordinates of its four corners, given in counterclockwise order, starting from the corner corresponding to the lower-left one of the largest map. It is guaranteed that the input data is correct, that is, the map is rectangular, linear sizes of the map are all in compliance with its scale and linear sizes of the largest map, and the map is completely within the largest map.

You may also assume that the smallest map has no common points with the border of the largest map (although you may put the medium map in such a way that it has common border points with either of the other maps).

The scales of the maps satisfy 102 >= s1 > s2 > s3 >= 10-2, it is guaranteed that the difference between any two scales is at least 10-2.

Output

For each test case, if it is impossible to find the requested place for the medium map, print "impossible" on a single line. In the other case print eight real numbers - the coordinates of the corners of the second map in counterclockwise order, starting from the corner corresponding to the lower-left one of the largest map. Making calculations with the precision of 10-6 is satisfactory. Do not print blank lines in output.

Sample Input

```2

1.0 10.0 5.0
0.3
0.2 3.0 2.5 1.0 2.5 1.0 1.5 3.0 1.5

1.0 1.0 1.0
0.5
0.1 0.11 0.01 0.11 0.11 0.01 0.11 0.01 0.01
```

Sample Output

```3.2500000000 2.7083333333 0.2500000000 2.7083333333 0.2500000000 1.2083333333 3.2500000000 1.2083333333
impossible
```

Author: Andrew Stankevich
Source: Andrew Stankevich's Contest #7
Submit    Status