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

getsolve :: Int -> Int
getsolve num
    | num == 1		= 1
    | num == 2		= 3
    | num == 3		= 1
    | num == 4		= 2
    | num == 5		= 1
    | num == 6		= 2
    | num == 7		= 1
    | num == 8		= 1
    | num == 9		= 2
    | num == 10		= 1
    | num == 11		= 2
    | num == 12		= 1