solve :: Int -> Int -> String
solve x y
  | x `elem` [1,3,5,7,8,10,12] = if y `elem` [1,3,5,7,8,10,12] then "Yes" else "No"
  | x `elem` [4,6,9,11] = if y `elem` [4,6,9,11] then "Yes" else "No"
  | x `elem` [2] = if y `elem` [2] then "Yes" else "No"

main = do
  [x,y] <- fmap read <$> words <$> getLine :: IO[Int]
  putStrLn $ solve x y
