import Data.List (sort, elemIndices)
import Control.Applicative
import Control.Monad
import qualified Data.Map as M

main :: IO ()
main = do
    [n, m] <- (map read . words) <$> getLine
    xys <- map readLine2 <$> replicateM m getLine
    putStrLn $ if solve n xys then "YES" else "NO"

-- |
--
-- >>> solve 4 [(1,2),(2,4),(1,3),(3,4)]
-- True
--
-- >>> solve 5 [(1,2),(3,5),(5,1),(3,4),(2,3)]
-- False
solve :: Int -> [(Int, Int)] -> Bool
solve n xys = all even ns
  where
    (xs, ys) = unzip xys
    zs = sort $ xs ++ ys
    ns = [length $ elemIndices x zs | x <- [1 .. n]]

-- Util
readLine2 :: String -> (Int,Int)
readLine2 = tuplify2 . map read . words

tuplify2 :: [a] -> (a, a)
tuplify2 [] = undefined
tuplify2 [x] = undefined
tuplify2 (x:y:_) = (x, y)
