Triveni Sangam

3.6

30 votes
Problem

Difficulty level: Moderate to Difficult

Salt n Pepper Restaurant Chain have three restaurants at different places in Gandhinagar. They also have a storehouse but it is not equidistant from all restaurants. Hence they face much expense in transportation as well as time. So they decide to setup a storehouse which would be equidistant from all the three restaurants. They started looking for the co-ordinates of their restaurants and tried to find the exact location of their desire but got confused. So they selected you to solve this problem for them with the promise of awarding you free meal.

You will be given co-ordinates of the 3 restaurants.

Your task will be to find co-ordinates of the location which is equidistant from all 3 restaurants if possible.

Input: First line contains number of testcases T.(1<=T<=10)

Each testcase is represented by three lines, each one with a pair of integers Xi,Yi, denoting the x and y co-ordinates of ith restaurant. (-3000<=Xi,Yi<=3000)for i=1,2,3. It is guaranteed that all given points are different.

Output: Print on a single line two integers separated by white-space (i.e. x y ), which denote the co-ordinate of the store-house. Print only the integer part of the correct co- ordinates i.e., if -3.5 4.5 is the answer then print -3 4. Or Print "Impossible" if it is not possible to find such co-ordinates for the store- house.

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?