n, m = map(int, input().split())
gr = {i: [] for i in range(1, n + 1)}
ans = "Yes"

for _ in range(m):
    l, r, d = map(int, input().split())
    if l < r:
        gr[l].append((r, d))
    else:
        gr[r].append((l, -d))
pos = [-1 for _ in range(n + 1)]
for u in range(1, n + 1):
    if pos[u] < 0:
        pos[u] = int(1e9)
    for (v, d) in gr[u]:
        if pos[v] < 0:
            pos[v] = pos[u] + d
        elif pos[v] != pos[u] + d:
            ans = "No"
            break
print(ans)