main :: IO ()
main = do
  [x, y] <- map toInt . words <$> getLine
  putStrLn $ if group x == group y then "Yes" else "No"

toInt :: String -> Int
toInt = read 

data G = A | B | C deriving Eq

group :: Int -> G
group n = case n of
  1  -> A
  3  -> A
  5  -> A
  7  -> A
  8  -> A
  10 -> A
  12 -> A
  4  -> B
  6  -> B
  9  -> B
  11 -> B
  2  -> C
  _  -> error "error"