#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const ll INF = 10000000000;
const int MAX_N = 100000;

int main() {
	cin.sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	if (M == 0) {
		cout << "Yes" << endl;
		return 0;
	}
	map<int, ll>mp;
	vector<ll>R(M), L(M), D(M);
	rep(i, M) {
		cin >> R[i] >> L[i] >> D[i];
		st.insert(R[i]);
		st.insert(L[i]);
	}
	ll sum = 0,start=10000000000;
	ll r = 0, l = INF;
	rep(i, M) {
		if (mp[R[i]] == 0 && mp[L[i]] == 0) {
			mp[R[i]] = start;
			mp[L[i]] = start - D[i];
		}
		else if (mp[R[i]] == 0) {
			mp[R[i]] = mp[L[i]] + D[i];
		}
		else if (mp[L[i]] == 0) {
			mp[L[i]] = mp[R[i]] - D[i];
		}
		else {
			if (mp[R[i]] - mp[L[i]] != D[i]) {
				cout << "No" << endl;
				return 0;
			}
		}
		r = max(r, mp[R[i]]);
		l = min(l, mp[L[i]]);
	}
	cout << "Yes" << endl;
	
	return 0;
}
