loop do
  n, m = gets.split.map(&:to_i)
  break if n==0 and m==0
  es = Array.new(n+1){[]}
  m.times{
    a, b = gets.split.map(&:to_i)
    es[a] << b
    es[b] << a
  }
  if m>=n or es.any?{|a| a.size>2}
    puts "no"
    next
  end
  visited = Array.new(n+1){false}
  dfs = ->x{
    es[x].each{|y|
      if not visited[y]
        visited[y] = true
        dfs[y]
      end
    }
  }
  (1..n).each{|i|
    if es[i].size==0
      visited[i] = true
    elsif es[i].size==1
      visited[i] = true
      dfs[i]
    end
  }
  visited[0] = true
  if visited.all?
    puts "yes"
  else
    puts "no"
  end
end
