import Prelude

main :: IO ()
main = do
  [x, y] <- readInts
  putStrLn $ if isGroupOf x == isGroupOf y then "Yes" else "No"

isGroupOf :: Int -> Int
isGroupOf n = fst $ head $ filter (elem n . snd) groups

groups :: [(Int, [Int])]
groups = zip [0..] [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]

readInts :: IO [Int]
readInts = map read . words <$> getLine
