import Control.Monad import Data.Graph import Data.Array main = do [n,m] <- map read . words <$> getLine ls <- replicateM m $ map read . words <$> getLine let g = buildG (0,n-1) [p | [a,b] <- ls, p <- [(a,b),(b,a)]] v = length $ filter (not . null) $ elems g r = length $ reachable g (head $ head ls) o = length $ filter (odd . length) $ elems g putStrLn $ if v == r && o <= 2 then "YES" else "NO"