#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
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<int> R(M), L(M), D(M);
  set<int> st;
  for (int i = 0; i < (int)(M); i++) {
    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;
  while (st.size() - sum) {
    bool flag = false;
    for (int i = 0; i < (int)(M); i++) {
      if (!flag && mp[R[i]] == 0 && mp[L[i]] == 0) {
        mp[R[i]] = start;
        mp[L[i]] = start - D[i];
        sum += 2;
        flag = true;
      } else if (mp[R[i]] == 0) {
        mp[R[i]] = mp[L[i]] + D[i];
        sum++;
      } else if (mp[L[i]] == 0) {
        mp[L[i]] = mp[R[i]] - D[i];
        sum++;
      } 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]]);
      if (r - l > 1000000000 || r - l < 0) {
        cout << "No" << endl;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}
