main :: IO ()
main = do
  [x, y] <- map (read :: String -> Int) . words <$> getLine
  putStrLn $ solve x y


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