This page is still under construction.

Parts of this page are still being built. What you see may change.

All in good fun!

Time limit1sMemory limit512 MB

Summary
Given three non-parallel lines, find the minimum possible value of the largest distance from a point to any of the three lines.
Level

Hard8 of 10

Topics
Geometry, Binary search, Math, Implementation
Solved
No attempts yet

Problem

Policeman Biteusz loves pranking his friends from the police station. For example, his last joke was signing up his friend Bajteusz for patrolling the city on all Sundays and holidays left this year. However, Biteusz hasn't been so happy since he heard about the new work. Biteusz has to patrol three designated streets. Roads in Bajtocja are straight and no two streets are parallel, so he will have to patrol some, perhaps degenerate to a point, triangle. The policeman will stand at the best place possible, so as to minimize the maximum distance which he'd possibly have to travel when called to run to the specified street. Biteusz has been wondering how far he will have to run when called. Help him and calculate the minimum distance!

Input

In the first line one integer Z≤104Z \le 10^4 is given, denoting number of testcases described in following lines.

The first line of each test case contains 33, the number of roads in Bajtocja. Each of the next 33 lines contains three integers a_ia\_i, b_ib\_i, c_ic\_i, the description of the ii-th road, meaning that the road is a line fulfilling the equation: a_ix+b_iy+c_i=0a\_{i}x + b\_{i}y + c\_i = 0

Output

For each test case you should print the minimum distance which Biteusz will have to travel. Your answer will be accepted if the absolute or relative error doesn't exceed 10−610^{-6}.

Constraints

  • ∣a_i∣,∣b_i∣,∣c_i∣≤106|a\_i|, |b\_i|, |c\_i| \leq 10^{6}
  • ∣a_i∣+∣b_i∣>0|a\_i|+|b\_i| > 0
  • No two given lines are parallel.

Examples1

  1. Example 1

    Input
    2
    3
    1 0 0
    0 1 0
    1 1 -1
    3
    1 1 -3
    -3 1 1
    1 0 -4
    
    Expected output
    0.292893218813452
    1.399173588432128