Scaled Triangle (Small)

Given a triangle and its rotated, translated, and shrunk copy with matching corners, find the unique fixed point of the similarity transformation.

Medium5GeometryMathImplementationNo attempts yetTime limit5sMemory limit512 MB

Problem

You have two triangle shaped pictures. The second picture is the first one translated, rotated, and then scaled down by a single factor. The factor is greater than 00 and less than 11. Both pictures lie on a table, and the second picture fits completely inside the first one. The second picture may touch the boundary of the first one.

The three corners of the second triangle correspond in order to the three corners of the first triangle. Widening that correspondence to the whole picture fixes one transformation of the plane. To process the picture you need the point this transformation leaves in place, that is, the position where a point of the first picture and the same point of the scaled picture overlap exactly. Because the factor is less than 11, exactly one such point always exists.

Find the coordinates of that point.

Input

The first line contains the number of test cases NN. Each test case takes two lines, and each line gives the coordinates of one triangle as six space separated integers in the format x1 y1 x2 y2 x3 y3. The first of the two lines is the first triangle and the second one is the second triangle. The point (x1,y1)(x_1, y_1) of the first triangle corresponds to the same corner of the picture as (x1,y1)(x_1, y_1) of the second triangle, and (x2,y2)(x_2, y_2) and (x3,y3)(x_3, y_3) correspond the same way.

Limits

  • 1N101 \le N \le 10
  • Every coordinate is an integer between 10000-10000 and 1000010000.
  • The three points of one triangle are never collinear.
  • Every triangle is an isosceles right triangle, so its angles are 45 degrees, 45 degrees, and 90 degrees.
  • The second triangle is the first triangle translated, rotated, and scaled by a factor greater than 00 and less than 11, and it lies inside the first triangle.

Output

For each test case, print one line that starts with Case #t: , where t is the test case number counting from 11. After it print the xx coordinate and the yy coordinate of the overlapping point, separated by one space.

Print both coordinates rounded to six digits after the decimal point. If a rounded coordinate is 00, print it as 0.000000 with no minus sign. No input has an ambiguous rounding at the seventh digit after the decimal point.