#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<ll> pos;
vector<vector<ll>> T;
vector<bool> seen;
map<pair<ll, ll>, ll> mp;
bool dfs(ll i) {
  for (auto next_i : T[i]) {
    if (seen[next_i] == true) {
      if (mp[make_pair(i, next_i)] != pos[next_i] - pos[i]) return false;
    } else {
      seen[next_i] = true;
      if (pos[next_i] == 1e10) {
        pos[next_i] = pos[i] + mp[make_pair(i, next_i)];
      } else if (mp[make_pair(i, next_i)] != pos[next_i] - pos[i])
        return false;
      dfs(next_i);
    }
  }
  return true;
}
int main() {
  ll N, M;
  cin >> N >> M;
  pos.assign(N + 1, 1e10);
  seen.assign(N + 1, false);
  T.assign(N + 1, vector<ll>());
  ll m = 1e6;
  for (int i = 0; i < M; i++) {
    ll L, R, D;
    cin >> L >> R >> D;
    mp[make_pair(L, R)] = D;
    T[L].emplace_back(R);
    m = min(m, L);
  }
  for (int i = m; i <= N; i++) {
    if (pos[i] == 1e10) pos[i] = 0;
    seen[i] = true;
    if (!dfs(i)) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
