N, M = map(int, raw_input().split())
a = []
for i in range(M):
    a.append(map(int, raw_input().split()))
x = [0 for i in range(N)]
y = [False for i in range(N)]
answer = 'Yes'
for i in range(M):
	L = a[i][0]
	R = a[i][1]
	D = a[i][2]
	if y[L-1] == False and y[R-1] == False:
		x[R-1] = x[L-1] + D
		y[L-1] = True
		y[R-1] = True
	elif y[L-1] == False and y[R-1] == True:
		x[L-1] = x[R-1] - D
		y[L-1] = True
	elif y[L-1] == True and y[R-1] == False:
		x[R-1] = x[L-1] + D
		y[R-1] = True
	elif y[L-1] == True and y[R-1] == True:
		if x[R-1] - x[L-1] == D:
			pass
		else:
			answer = 'No'
			break
print answer