import Control.Monad (replicateM) data Length = Short | Long deriving (Eq) f x y x1 y1 | x < x1 = if y <= y1 then (Short, (0, 10000), Long, (10000, 10000)) else (Short, (0, t), Long, (t, 10000)) | x == x1 = if y < y1 then (Long, (0, 0), Short, (0, 10000)) else if y == y1 then (Short, (0, 0), Long, (0, 0)) else (Short, (0, 0), Long, (0, 10000)) | otherwise = if y < y1 then (Long, (0, t), Short, (t, 10000)) else (Long, (0, 10000), Short, (10000, 10000)) where t = - (x - x1) / (y - y1) -- [-, -)同士 intersect (x1, y1) (x2, y2) = x1 /= y1 && x2 /= y2 && not (y2 <= x1 || y1 <= x2) -- [-, -)と(-, -] intersect' (x1, y1) (x2, y2) = x1 /= y1 && x2 /= y2 && not (y2 < x1 || y1 <= x2) main = do n <- readLn replicateM n $ do [x2, x1, x3, y2, y1, y3] <- fmap (map (fromIntegral . read) . words) getLine let (l1, r1, l2, r2) = f x2 y2 x1 y1 (l1', r1', l2', r2') = f x3 y3 x1 y1 can = if l1 == l1' then intersect r1 r1' || intersect r2 r2' else intersect' r1 r2' || intersect' r1' r2 putStrLn $ if can then "YES" else "NO"