tr '.' = ' ' tr c = c version = sum . zipWith (*) [1000000, 1000, 1] . map read . words . map tr main = do a <- getLine b <- getLine print $ version a print $ version b putStrLn $ if version a < version b then "NO" else "YES"