#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6;
tuple<int, int, int> lrd[maxn];
bool was[maxn];
map<int, int> m;
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  int l, r, d;
  for (int i = 0; i < k; ++i) {
    scanf("%d %d %d", &l, &r, &d);
    if (d < 0)
      lrd[i] = make_tuple(r - 1, l - 1, -d);
    else
      lrd[i] = make_tuple(l - 1, r - 1, d);
  }
  sort(lrd, lrd + k);
  tie(l, r, d) = lrd[0];
  m[l] = 1;
  was[l] = true;
  for (int i = 0; i < k; ++i) {
    tie(l, r, d) = lrd[i];
    if (was[l] && was[r]) {
      if (m[r] - m[l] != d) {
        cout << "No" << endl;
        return 0;
      }
    } else {
      if (was[l]) {
        m[r] = m[l] + d;
        was[r] = true;
        continue;
      }
      if (was[r]) {
        m[l] = m[r] - d;
        was[l] = true;
        continue;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}
