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

rights = [{} for _ in range(N)]

for m in range(M):
    L, R, D = map(int, input().split())
    rights[L-1][R-1] = D

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

print('Yes')
