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