N, M = gets.split.map(&:to_i) E = Hash.new { |h, k| h[k] = [] } M.times do a, b = gets.split.map(&:to_i) E[a] << b E[b] << a end def f E.all? { |u, list| list.size.even? } end def g odd_cnt = 0 even_cnt = 0 E.each do |u, list| if list.size.even? even_cnt += 1 else odd_cnt += 1 end end odd_cnt == 2 end if f || g puts 'YES' else puts 'NO' end