main :: IO ()
main = do
  [p, q] <- map read . words <$> getLine
  let a = [1,3,5,7,8,10,12]
      b = [4,6,9,11]
      c = [2]
      str = if (p `elem` a && q `elem` a)
            || (p `elem` b && q `elem` b)
            || (p `elem` c && q `elem` c) then "Yes"
                                          else "No"
  putStrLn str
