n,m = gets.split.map &:to_i


ngra = n.times.map{[]}


m.times.map{
  l,r,d = gets.split.map &:to_i
  ngra[l-1] << [r-1, d]
  ngra[r-1] << [l-1,-d]
}

hp = {}

ngra.each.with_index{|tmp,i|
  if !hp[i]
    hp[i] = 0
  end
  tmp.each{|e,d|
    if !hp[e]
      hp[e] = hp[i]+d
    elsif hp[e] != hp[i]+d
      puts 'No'
      exit
    end
  }
}


puts 'Yes'