{-# LANGUAGE ScopedTypeVariables, LambdaCase #-}

import qualified Data.List as List
import qualified Data.Set as Set

group :: Int -> Int
group x | x `elem` [1,3,5,7,8,10,12] = 1
group x | x `elem` [4,6,9,11] = 2
group _ = 3

main :: IO ()
main = do
    [a, b] :: [Int] <- map read . words <$> getContents
    putStrLn $ if group a == group b then "Yes" else "No"