Limits 2s, 512 MB

We all know the great story of the Ant and the Grasshopper. Clever Ant survived the tough time of winter and moved to a strange place called Braavos. Braavos is a triangle-shaped land with three big circular oceans touching all three sides (or side's extensions) of the land. See the picture below for clear view of Braavos.
Here ∆ABC is Braavos and three circles are the oceans. Oceans have no part inside the land of Braavos and touches all three sides (or side's extensions).

Now Mr. Ant wants to build a house in Braavos. But somehow he came to know that often dangerous tidal wave comes from the oceans and destroys everything close to shore. So Mr. Ant wants to build a house that is equally away from all the oceans.

Now you are given the coordinates of Braavos (point A, B, C of the picture). You need to find a point P such that it is equally away from all of the oceans.

In other words, Let X, Y, Z be the closest point of the circle from a point P and PX = PY = PZ. You have to find such a point P.


Input starts with an integer T(1 ≤ T ≤ 105) which denotes the number of test cases.
Then for each test case, there will be six integers Ax, Ay, Bx, By, Cx, Cy(-105 ≤ Ax,y, Bx,y, Cx,y ≤ 105) denoting the coordinate of the Braavos.


For each test case, print three numbers Px, Py and D. Here, (Px, Py) denotes the coordinate of point P that is equally away from all three oceans and D denotes the distance from point P to the oceans. Errors less than 10-6 will be ignored.


0 2
-2 -1
2 -1
0 0.08333333 1.08333333

Equal distance point from the oceans and equal distance point from the touching point of the oceans with the land is not always the same.


Login to submit.


0% Solution Ratio
Toph uses cookies. By continuing you agree to our Cookie Policy.