N, M = gets.split.map(&:to_i)
LRDs = readlines.map{|l| l.split.map(&:to_i)}

@g = Array.new(N + 1){[]}
@x = Array.new(N + 1, 0)
@v = Array.new(N + 1, false)

def dfs(i)
  @v[i] = true
  @g[i].each do |j, d|
    if @v[j]
      return false if @x[j] != @x[i] + d
    else
      @x[j] = @x[i] + d
      return false unless dfs(j)
    end
  end
  true
end

LRDs.each do |l, r, d|
  @g[l] << [r, d]
  @g[r] << [l, -d]
end
puts (1 .. N).all?{|i| @v[i] || dfs(i)} ? 'Yes' : 'No'