#include <bits/stdc++.h>
using namespace std;
struct node {
  int to;
  int far;
};
int main(void) {
  int n, m;
  bool a = true;
  cin >> n >> m;
  vector<node> v[n];
  for (int i = 0; i < m; i++) {
    int l, r, d;
    cin >> l >> r >> d;
    v[l - 1].push_back({r - 1, d});
  }
  int x[100000] = {0}, done[100000] = {0};
  for (int i = 0; i < n; i++) {
    for (auto itr = v[i].begin(); itr != v[i].end(); ++itr) {
      if (done[i] != 0 && done[itr->to] != 0 && x[itr->to] != x[i] + itr->far) {
        a = false;
      } else if (done[i] == 0) {
        x[i] = x[itr->to] - itr->far;
        done[i]++;
        done[itr->to]++;
      } else if (done[itr->to] == 0) {
        x[itr->to] = x[i] + itr->far;
        done[i]++;
        done[itr->to]++;
      }
    }
    if (!a) break;
  }
  string ans = (a) ? "Yes" : "No";
  cout << ans << endl;
}
