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) M.times do a, b = gets.split.map(&:to_i) D[a] += 1 D[b] += 1 R.unite!(a,b) end s = D.index{|v| v > 0 } o = N.times.count{|i| D[i].odd? } if o == 2 || o == 0 puts D.each_with_index.all?{|c,u| c.zero? ^ R.same?(s, u) } ? "YES" : "NO" else puts "NO" end