import sys
N, M = map(int, input().split())

conditions = sorted([[int(n) for n in input().split()] for _ in range(M)], reverse = True)

rights = [{} for _ in range(N)]
for l, r, d in conditions:
    if r-1 in rights[l-1] and rights[l-1][r-1] != d:
        print('No')
        sys.exit()
    if l-1 in rights[r-1] and rights[r-1][l-1] != -d:
        print('No')
        sys.exit()
    rights[l-1][r-1] = d
    for s, e in rights[r-1].items():
        if s in rights[l-1] and rights[l-1][s] != d + e:
            print('No')
            sys.exit()
        if l-1 in rights[s] and rights[s][l-1] != - (d + e):
            print('No')
            sys.exit()
        rights[l-1][s] = d + e

print('Yes')
