Welcome to ZOJ
 Problem Sets Information Select Problem Runs Ranklist
ZOJ Problem Set - 1776
Study Group

Time Limit: 2 Seconds      Memory Limit: 65536 KB

Jill approached Jana and Pia. They agreed at an earlier time that they were supposed to study for a big exam in their Geometry class. Jill greeted them, "How are you, girls? Have you heard of the latest from Boy Abunda, that crazy TV showbiz host?"

"With the upcoming exam in Geometry, I'm not able to keep track of these things," Pia retorted. "Anyway, why don't we start the study group already?"

This was the best opportunity for Jana to bring up a problem. "I've been trying to hurdle this particular problem, regarding angle bisectors meeting at a certain point."

Possessing wit beyond compare among her peers, Jill, with such overflowing confidence, exhorted, "Well, Jana, you prove that indirectly. Assume that they don't meet at a singular point ..."

"No, no, no, we're figured that out just a while back," Pia cut in. "We're wondering how to get the coordinates of the intersection of angle bisectors of a triangle, given the three vertices of the same triangle."

Jana and Jill started poring themselves over all available materials they had placed on their desk ... but to no avail. "I can't seem to find anything in here that could actually help us in this issue," Jill rued, "That's so annoying, ha?" "Yahh, you're telling me," Jana concurred, doodling a diagram to help them visualize the problem.

As they were still engrossed over this problem, Pia somehow cranked up their intellectual juices and came up with a daring idea, "Why don't we program a solution for this?"

Let's say you're in Pia's position. Your task is to create a solution that determines the coordinates of the intersection of the angle bisectors of a triangle, given the coordinates of the vertices.

Input

The first line of the standard input indicates the number of triangles you need to resolve, which do not exceed 100 triangles. The following lines would contain the vertex sets that contain the coordinates of the triangle, devoting each line for every vertex. The numbers in the coordinates are separated only by a comma and are integers whose absolute value does not exceed 65,535.

Output

Each line would contain the coordinates of the vertices for a triangle and the coordinates of the intersection of their angle bisectors, following the format below:

(x1,y1)(x2,y2)(x3,y3):(x4,y4)

where (x1,y1), (x2,y2), (x3,y3) refer to the coordinates of the vertices and (x4,y4) refer to the coordinates of the angle bisector intersection. Truncate to 4 decimal places.

Sample Input

2
0,0
100,100
200,0
0,0
200,200
400,0

Sample Output

(0,0)(100,100)(200,0):(100.0000,41.4213)
(0,0)(200,200)(400,0):(200.0000,82.8427)

Source: Asia 2003, Manila (Philippine)
Submit    Status