Little Jerry is now in trouble. His teacher gave him a task. He needs to draw a trapezium given the lengths of the sides. Jerry has started drawing and he has drawn the bigger parallel side but cannot proceed from here. So he is asking for your help. As he has already put two points of the trapezium, you just need to tell him the other two points so that he can complete his drawing.
More specifically, see the picture on the right with a Trapezium ABCD where the points are in counter clockwise order and AB is the larger parallel side. You are given point A, point B and the lengths BC, CD, DA. You need to find points C and D.
Input
Input starts with an integer T (≤ 500), denoting the number of test cases.
Each case starts with a line containing seven integers Ax, Ay, Bx, By, b, c, d. Here (Ax, Ay) is the coordinate of point A, (Bx, By) is the coordinate of point B. b, c and d are the lengths of the segments BC, CD and DA respectively. All the coordinates will be in the range [-10000, 10000] and the lengths will be in the range [1, 10000]. You may assume that a valid trapezium is possible with the given data and the length of CD will be strictly less than the length of AB.
Output
For each line of input produce two lines of output. The first line will contain the case number and the second line will contain four real numbers Cx, Cy, Dx, Dy where (Cx, Cy) is the coordinate of point C and (Dx, Dy) is the coordinate of point D. Errors less than 10-6 will be ignored.
Sample
Sample Input | Sample Output |
---|---|
2 0 0 20 0 10 14 8 0 0 14 0 7 11 5 | Case 1: 14 8 0 8.000 Case 2: 8.5 4.33012701 -2.5 4.33012701 |