import Control.Applicative import Control.Monad main :: IO () main = do n <- readLn solve <$> replicateM n (getLine >> replicateM 6 f) >>= mapM_ print where f = map read <$> words <$> getLine solve :: [[[Double]]] -> [Double] solve = map f where f = minimum . filter (>= 0.0) . map ang . filter (\[x, y] -> x < xmx && x > xmn && y > 0) xmn = cos (pi * 171 / 180.0) xmx = cos (pi * 119 / 180.0) ang :: [Double] -> Double ang [x, _] | abs a < 0.0000001 = 0.0 | otherwise = a where a = 180.0 * acos x / pi - 120.0