URI Online Judge | 1783

Oh no, a Black Hole!

By Mário Henrique, UFPE BR Brazil

Timelimit: 2

Andre is an amateur astronomer that struggles to reveal a truth to the world: there’s a black hole coming to Earth! All the other astronomers think he’s crazy, and consequently, the normal people too, but he doesn’t gives up bringing down this conspiracy!

But how did he discovered the black hole? It happened this way: black holes have an overwhelming gravity, such that the nearest stars begin spinning around them. Some of them move faster, some move slower, some keep closer, and some keep more distant, but every affected star keeps constant angular velocity and distance from the black hole. One day, while watching the sky with his telescope, Andre recorded the positions of every star he could see. A month later, he repeated the feat and saw that two of the stars had moved, implying that they felt in the orbit of a black hole!

The above image illustrates the trajectory of two stars around a black hole

Andre sucks at math, so he can’t calculate the exact position of the black hole. The surface of the sky can be represented by a coordinated plain with axes X and Y, and he has the old and new coordinates of both stars. Help him by calculating the black hole’s coordinates and save the world before it’s too late!


The first line of input contains an integer T (1 ≤ T ≤ 10000), the number of test cases. Each test case has 4 lines, each with a pair of real numbers with 2 decimal places, X e Y (-1000.0 ≤ X, Y ≤ 1000.0). Each pair represents, respectively, the old coordinates of the first and second stars, and the new coordinates of the first and second stars. The old and new positions of each star are different, as well as the positions of the two stars at the same time instant.


For each test case, print "Caso #i: X Y" in a line, where i is the test case number, beginning at 1, and (X, Y) are the coordinates of the black hole. X and Y must be real numbers with 2 decimal places each. For each test case there’s only one valid solution.

Input Sample Output Sample
12.00 2.00
5.00 6.00
10.00 8.00
2.00 7.00
0.50 -0.50
-1.00 0.00
-0.50 -0.50
0.00 1.00
0.50 6.50
-10.50 -3.50
-1.50 6.50
-5.50 -8.50
Caso #1: 2.00 2.00
Caso #2: 0.00 0.00
Caso #3: -0.50 1.50