N, M = map(int, input().split())
arcs = {}
for _ in range(M):
    l, r, d = tuple(map(int, input().split()))
    arcs[l, r] = d

def consistent(arcs):
    for u, v, d in LRD:
        for w in range(u + 1, v):
            if (u, w) in arcs and (w, v) in arcs:
                if arcs[u, w] + arcs[w, v] != arcs[u, v]:
                    return False
    return True

if consistent(arcs):
    print('Yes')
else:
    print('No')