{-# LANGUAGE OverloadedStrings #-} import Data.List (unfoldr) import Data.Function (on) main :: IO () main = solve <$> f >>= putStrLn where f = map read <$> words <$> getLine solve :: [Int] -> String solve [a, b] = h a b where f = unfoldr $ \x -> if x == 0 then Nothing else let (q, r) = divMod x 10 in Just (r, q) g _ [] = "Yes" g [] _ = "No" g (a:as) (b:bs) | a >= b = g as bs | otherwise= "No" h = g `on` f