#include <bits/stdc++.h>
using namespace std;
const long long INF = 100000000000LL;
vector<pair<int, int> > v1[100001], v2[100001];
long long c[100001];
int n, m;
long long l[200001], r[200001], d[200001];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) c[i] = INF;
  bool b = false;
  for (int i = 0; i < m; ++i) {
    cin >> l[i] >> r[i] >> d[i];
    if (c[l[i]] == INF && c[r[i]] == INF) {
      c[l[i]] = 0;
      c[r[i]] = d[i];
    }
    if (c[l[i]] == INF && c[r[i]] != INF) {
      c[l[i]] = c[r[i]] - d[i];
    }
    if (c[l[i]] != INF && c[r[i]] == INF) {
      c[r[i]] = c[l[i]] + d[i];
    }
  }
  for (int i = 0; i < m; ++i) {
    if (c[r[i]] - c[l[i]] != d[i]) b = true;
  }
  if (b)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  return 0;
}
