#include <bits/stdc++.h>
using namespace std;
;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 10;
const int MAX_N = 100000;
const int MAX_M = 200000;
int N, M, L, R, D;
int pos[MAX_N];
bool ans = true;
vector<vector<pair<int, int> > > dist(MAX_N);
int main() {
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    pos[i] = INF;
  }
  for (int i = 0; i < M; i++) {
    cin >> L >> R >> D;
    L--;
    R--;
    dist[L].push_back(make_pair(R, D));
  }
  for (int i = 0; i < N; i++) {
    bool flag = false;
    int p, d;
    for (vector<pair<int, int> >::iterator it = dist[i].begin();
         it != dist[i].end(); ++it) {
      if (pos[it->first] != INF) {
        flag = true;
        p = it->first;
        d = it->second;
        break;
      }
    }
    if (pos[i] == INF) {
      if (flag) {
        pos[i] = pos[p] - d;
        for (vector<pair<int, int> >::iterator it = dist[i].begin();
             it != dist[i].end(); ++it) {
          if (pos[it->first] == INF) {
            pos[it->first] = pos[i] + it->second;
          } else {
            if (pos[it->first] != pos[i] + it->second) {
              ans = false;
            }
          }
        }
      } else {
        pos[i] = 0;
        for (vector<pair<int, int> >::iterator it = dist[i].begin();
             it != dist[i].end(); ++it) {
          pos[it->first] = it->second;
        }
      }
    } else {
      for (vector<pair<int, int> >::iterator it = dist[i].begin();
           it != dist[i].end(); ++it) {
        if (pos[it->first] == INF) {
          pos[it->first] = pos[i] + it->second;
        } else {
          if (pos[it->first] != pos[i] + it->second) {
            ans = false;
          }
        }
      }
    }
  }
  cout << (ans ? "Yes" : "No") << endl;
  return 0;
}
