import Control.Monad (replicateM) import Data.List (nub) data State = Short | Long | Mix | None deriving (Eq, Show) f x y x1 y1 | x < x1 = if y <= y1 then Short else Mix | x == x1 = if y < y1 then Short else if y == y1 then None else Long | otherwise = if y < y1 then Mix else Long main = do n <- readLn replicateM n $ do [x2, x1, x3, y2, y1, y3] <- fmap (map read . words) getLine let s1 = f x2 y2 x1 y1 s2 = f x3 y3 x1 y1 can' = case (s1, s2) of (Mix, _) -> True (_, Mix) -> True _ -> s1 == s2 can = (maximum [ x1, x2, x3 ] == x1 || minimum [ x1, x2, x3 ] == x1) && length (nub [ x1, x2, x3 ]) == length [ x1, x2, x3 ] || (maximum [ y1, y2, y3 ] == y1 || minimum [ y1, y2, y3 ] == y1) && length (nub [ y1, y2, y3 ]) == length [ y1, y2, y3 ] || (x2 - x1) * (y3 - y1) /= (x3 - x1) * (y2 - y1) && can' putStrLn $ if can then "YES" else "NO"