getMonthGroup :: Int -> Int
getMonthGroup x | elem x [2] = 28
                | elem x [4, 6, 9, 11] = 30
                | otherwise = 31

main = do
    [x, y] <- map read . words <$> getLine :: IO [Int]
    putStrLn $ if getMonthGroup x == getMonthGroup y then "Yes" else "No"
