n, m = map(int, input().split())

l, r, d = [], [], []

for i in range(m):
    l_, r_, d_ = map(int, input().split())
    if l_ < r_:
        l.append(l_-1)
        r.append(r_-1)
        d.append(d_)
    else:
        l.append(r_-1)
        r.append(l_-1)
        d.append(-d_)

import numpy as np
arg = np.argsort(l)

l, r, d = np.array(l)[arg], np.array(r)[arg], np.array(d)[arg]
p = [None for i in range(n)]

def solve():

    if m == 0:
        print("Yes")
        return
    
    for i in range(m):
        if p[l[i]] is None and p[r[i]] is None:
            # initialize
            p[l[i]] = 0
            p[r[i]] = d[i]
        elif p[l[i]] is None:
            # add rule
            p[l[i]] = p[r[i]] - d[i]
        elif p[r[i]] is None:
            # add rule
            p[r[i]] = p[l[i]] + d[i]
        else:
            # check rule
            if p[r[i]] - p[l[i]] != d[i]:
                print("No")
                return

    # check max position
    if max(p) > 10**9:
        print("No")
    else:
        print("Yes")

solve()