N, M = map(int, input().split())
loc = [float('inf')] * (N + 1)
ok = True
for _ in range(M):
    L, R, D = map(int, input().split())
    if loc[L] < float('inf'):
        if loc[R] < float('inf'):
            if loc[L] + loc[R] != D:
                ok = False
                # print(L, R, D)
                # print(loc[L], loc[R], D)
                break
            else:
                pass
        else:
            loc[R] = loc[L] + D
    else:
        if loc[R] < float('inf'):
            loc[L] = loc[R] - D
        else:
            loc[L] = 0
            loc[R] = D
print('Yes' if ok else 'No')
