    -- Try AtCoder
    -- author: Leonardone @ NEETSDKASU
     
    import qualified Data.Map as Map
     
    main = putStrLn . solve . lines =<< getContents
     
    solve (hw:xs) = if ans then "Yes" else "No" where
        f m c = Map.insertWith (+) c 1 m
        (fth, chs) = unzip
                   $ map divMod
                   $ Map.elems
                   $ foldl (foldl f) Map.empty xs
        [h, w] = map read $ words hw
        sat = 4 * sum fth >= (div h 2) ^ 2 * (div w 2) ^ 2
        ans | h > 1 && w > 1 && not sat = False
            | even h && even w = all (== 0) chs
            | even h || even w = all even chs
            | otherwise = (== 1) $ length $ filter odd chs 