N, M = map(int, input().split())
LRD = [list(map(int, input().split())) for i in range(M)]
LRD.sort(key=lambda x:x[0]or x[1])

people = [0] * (N+1)
peetru = [False] * (N+1)
for l, r, d in LRD:
    if (peetru[l]) & (peetru[r]):
        if abs(people[r]) + abs(people[l]) != d:
            print("No")
            break
    else:
        peetru[l] = True
        peetru[r] = True
        people[l] -= d
        people[r] += d
else:
    print("Yes")


