import Data.Monoid main = getContents >>= putStrLn . solve . map (map read . words') . lines where words' [] = [[]] words' (x : xs) | x == '.' = [] : y : ys | otherwise = (x : y) : ys where (y : ys) = words' xs solve :: [[Int]] -> String solve [[a0, b0, c0], [a1, b1, c1]] | cmp == LT = "NO" | otherwise = "YES" where cmp = compare a0 a1 `mappend` compare b0 b1 `mappend` compare c0 c1