import Control.Monad rInt :: String -> Int rInt = read split_char c [] = [] split_char c str = w : split_char c (case xs of "" -> []; _ -> tail xs) where (w, xs) = break (==c) str solve [ks, vs] | ks == vs = "YES" | otherwise = isKaseki ks vs where isKaseki [] [] = "YES" isKaseki (k:ks) (v:vs) | k > v = "YES" | k < v = "NO" | otherwise = isKaseki ks vs main = do kvs <- map ((map rInt) . split_char '.') <$> replicateM 2 getLine putStrLn $ solve kvs print kvs