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 M_{1}, M_{2} and M_{3} 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 M_{3} be placed atop the largest one M_{1} in such a way that it is
completely located within it. You have find the way to place the medium map M_{2}, in such a way that
the following conditions are satisifed:

- M
_{2} is completely located within M_{1};
- M
_{3} is completely located within M_{2};
- 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 x_{1}, y_{1}
of the largest map (1 <= x_{1}, y_{1} <= 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), (x_{1}, 0), (x_{1}, y_{1}) and (0, y_{1}).

The second line of each case contains one real number s_{2} - the scale of the medium map.

The third line of each case contains nine real numbers - the scale s_{3} 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 10^{2} >= s_{1} > s_{2} > s_{3} >= 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