### BUGGY CODE ###

import sys                                                                                  
l1 = list(map(int, input().split()))                                                        
N = l1[0]                                                                                   
M = l1[1]                                                                                   
                                                                                            
dat = []                                                                                    
                                                                                            
per_dis = [[ 0 for n in range(N+1)] for n in range(N+1)]                                    
                                                                                            
for n in range(M):                                                                          
    x = list(map(int, input().split()))                                                     
    dat.append(x)                                                                           
                                                                                            
for x in dat:                                                                               
    if per_dis[x[0]][x[1]] == 0 and per_dis[x[0]][x[1]] == 0:                               
        per_dis[x[0]][x[1]] = x[2]                                                          
        per_dis[x[1]][x[0]] = -x[2]                                                         
        for i in range(1,N):                                                                
            for j in range(i+1,N):                                                          
                if per_dis[i][j] != 0 and per_dis[i+1][j+1] != 0 and per_dis[i][j+1] == 0:  
                    per_dis[i][j+1] = per_dis[i][j] + per_dis[i+1][j+1]                     
                    per_dis[j+1][i] = -per_dis[i][j+1]                                      
                elif per_dis[i][j] == 0 and per_dis[i+1][j+1] != 0 and per_dis[i][j+1] != 0:
                    per_dis[i][j] = per_dis[i][j+1] - per_dis[i+1][j+1]                     
                    per_dis[j][i] = -per_dis[i][j]                                          
                elif per_dis[i][j] != 0 and per_dis[i+1][j+1] == 0 and per_dis[i][j+1] != 0:
                    per_dis[i+1][j+1] = per_dis[i][j+1] - per_dis[i][j]                     
                    per_dis[j+1][i+1] = -per_dis[i+1][j+1]                                  
    else:                                                                                   
        if abs(per_dis[x[0]][x[1]]) != x[2]:                                                
            print("No")                                                                     
            sys.exit(0)                                                                     
                                                                                            
                                                                                            
print("Yes")                                                                                

### FIXED CODE ###

from collections import deque

def bfs(x, graph, people):
    if people[x] is not None:
        return
    unvisited = deque([x])
    people[x] = 0
    while unvisited:
        now = unvisited.popleft()
        for next, d in graph[now]:
            if people[next] is None:
                people[next] =  people[now] + d
                unvisited.append(next)

def main():
    N, M = list(map(int, input().split()))

    graph = [ [] for n in range(N+1)]
    people = [None] * (N+1)

    for n in range(M):
        L, R, D = list(map(int, input().split()))
        graph[L].append((R, D))
        graph[R].append((L, -D))
    for i in range(1, N+1):
        bfs(i, graph, people)

    for i in range(1, N+1):
        for j, d in graph[i]:
            if people[j] - people[i] != d:
                print("No")
                exit()
    else:
        print("Yes")


if __name__ == "__main__":
    main()