def solve(N, M, lrd):
    xss = []
    def getx(n):
        for xs in xss:
            if n in xs:
                return xs
        xs = {n: 0}
        xss.append(xs)
        return xs
    for l, r, d in lrd:
        lxs = getx(l)
        rxs = getx(r)
        if lxs is rxs:
            if lxs[l] != rxs[r] - d:
                return 0
        else:
            delta = lxs[l] - rxs[r] - d
            for k in lxs:
                v = lxs[k] + delta
                if k in rxs:
                    if rxs[k] != v:
                        return 0
                rxs[k] = v
            xss.remove(lxs)
    for xs in xss:
        if max(xs.values()) - min(xs.values()) > 10**9:
            return 0
    return 1

N, M = [int(x) for x in input().split()]
lrd = []
for i in range(M):
    lrd.append([int(x) for x in input().split()])

#N, M = 3, 3
#lrd = [[1,2,1],[2,3,1],[1,3,2]]

#N, M = 4, 3
#lrd = [[2,1,1],[2,3,5],[3,4,2]]

#N, M = 10, 3
#lrd = [[8,7,100],[7,9,100],[9,8,100]]

#N, M = 100, 0
#lrd = []

if solve(N, M, lrd):
    print("Yes")
else:
    print("No")
