main = do
  (x:y:_) <- return . (map read) . words =<< getLine
  putStrLn $ yesno (f x == f y)

  where
    f n = filter (elem n)  [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
    yesno True = "Yes"
    yesno False = "No"
