import Data.Graph import Data.Bool import Data.Array main :: IO () main = solve <$> (read . head . words <$> getLine) <*> (map (map read . words) . lines <$> getContents) >>= putStrLn . bool "NO" "YES" solve :: Int -> [[Int]] -> Bool solve n es = (numOdd == 0 || numOdd == 2) && (length . bcc) g <= 1 where g = buildG (0, n - 1) . map (\[x, y] -> (x, y)) $ es ++ map reverse es numOdd = length . filter odd . elems . outdegree $ g