import Control.Monad
import Data.List

main = do
  [_, m] <- map read . words <$> getLine
  xss <- replicateM m getLine
  putStr . f . g $ xss
 
g = sort . concat
 
f [] = "YES"
f (x:y:zs) 
  | x == y = f zs
  | otherwise = "NO"