class UnionFind def initialize(n); @data = Array.new(n, &:itself); end def root(i); _compact(i, _root(i)); end def unite!(i,j); _compact(i, root(j)); end def same?(i,j); root(i) == root(j); end def _root(i); i = @data[i] until @data[i] == i; return i; end def _compact(i, r); @data[i], i = r, @data[i] until @data[i] == r; return r; end end N, M = gets.split.map(&:to_i) D = Array.new(N, 0) R = UnionFind.new(N) E = M.times.map{ gets.split.map(&:to_i) } E.each do |a,b| D[a] += 1 D[b] += 1 R.unite!(a,b) end s = E.flatten.min o = N.times.count{|i| D[i].odd? } if o == 2 || o == 0 puts E.all?{|a,b| R.same?(s, a) } ? "YES" : "NO" else puts "NO" end