import Data.Array.Unboxed (accumArray, elems, UArray) import Data.List (transpose) judge :: Int -> [[Int]] -> String judge m xs | head ss >= (sum $ tail ss) = "YES" | otherwise = "NO" where ar = accumArray (+) 0 (0, m) $ map (\(b : a : _) -> (b, a)) xs :: UArray Int Int ss = elems ar main :: IO () main = getLine >> getContents >>= putStrLn . judge 100 . transpose . map (map read) . map words . reverse . lines