import Control.Applicative
main = do
  _ <- getLine
  s <- lines <$> getContents    
  let v = map (map read . words) s
  let w = map (que [0] [0]) v
  mapM_ putStrLn w
            
que :: [Int] -> [Int] -> [Int] -> String
que _ _ [] = "YES"
que xa@(x:xs) ya@(y:ys) (r:rs) =
  if r>x && r>y  then
    if (r-x) < (r-y) then
      que (r:xa) ya rs
    else
      que xa (r:ya) rs
  else
    if r>x then
      que (r:xa) ya rs
    else if r>y then
           que xa (y:ya) rs
         else "NO"