import Control.Monad import Data.Graph import Data.Bool import Data.Tuple import Data.List import Data.Array import qualified Data.ByteString.Char8 as B main :: IO () main = do [n, m] <- map read . words <$> getLine es <- replicateM m $ (\[x, y] -> (x, y)) . map (maybe undefined fst . B.readInt) . B.words <$> B.getLine putStrLn . bool "NO" "YES" $ solve n (es ++ map swap es) solve :: Int -> [(Int, Int)] -> Bool solve n [] = True solve n es | numOdd == 0 || numOdd == 2 = us == vs | otherwise = False where g = buildG (0, n - 1) es numOdd = length . filter odd . elems . outdegree $ g vs = map head . group . sort . map fst $ es us = sort . reachable g . head $ vs