import Control.Applicative ((<$>), (<*>)) main :: IO () main = solve <$> f <*> f >>= putStrLn where f = map read <$> words <$> getLine solve :: [Int] -> [Int] -> String solve [n, m] [x, y] | f (x-1) == f (y-1) = "YES" | otherwise = "NO" where f i | even q = r | otherwise = m - 1 - r where (q, r) = divMod i m