#include <bits/stdc++.h>
using namespace std;
int inf = INT_MIN;
int x[200000] = {0};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, l, r, d;
  vector<pair<pair<int, int>, int>> v;
  cin >> n >> m;
  for (int i = 0; i < n; i += 1) {
    x[i] = -1 * inf;
  }
  long long int ans = 0;
  for (int i = 0; i < m; i++) {
    cin >> l >> r >> d;
    if (l > r) {
      swap(l, r);
      d = -1 * d;
    }
    l--;
    r--;
    v.push_back({{l, r}, d});
  }
  if (!m) {
    cout << "Yes" << endl;
    return 0;
  }
  sort(v.begin(), v.end());
  x[v[0].first.first] = 0;
  x[v[0].first.second] = v[0].second;
  for (int i = 1; i < m; i++) {
    auto p = v[i];
    if (x[p.first.first] == -1 * inf || x[p.first.second] == -1 * inf) {
      if (x[p.first.first] == -1 * inf && x[p.first.second] != -1 * inf)
        x[p.first.first] = x[p.first.second] - p.second;
      else if (x[p.first.first] != -1 * inf && x[p.first.second] == -1 * inf)
        x[p.first.second] = x[p.first.first] + p.second;
      else {
        x[p.first.first] = 0;
        x[p.first.second] = p.second;
      }
    } else {
      if (x[p.first.second] - x[p.first.first] != p.second) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  for (int i = 0; i < n; i += 1) {
    if (x[i] == -1 * inf) x[i] = 0;
  }
  for (int i = 0; i < m; i += 1) {
    auto p = v[i];
    if (x[p.first.second] - x[p.first.first] != p.second) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
