#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, M;
  cin >> N >> M;
  vector<tuple<int, int, long long>> v;
  vector<int> pos(N, 0);
  vector<bool> fixed(N, false);
  for (int i = 0; i < M; ++i) {
    int L, R, D;
    cin >> L >> R >> D;
    --L;
    --R;
    if (L < R) {
      v.push_back(make_tuple(L, R, D));
    } else {
      v.push_back(make_tuple(R, L, -D));
    }
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < M; ++i) {
    int l = get<0>(v[i]);
    int r = get<1>(v[i]);
    int d = get<2>(v[i]);
    if (fixed[l]) {
      if (fixed[r]) {
        if (pos[r] - pos[l] != d) {
          cout << "No\n";
          return 0;
        }
      } else {
        fixed[r] = true;
        pos[r] = pos[l] + d;
      }
    } else {
      fixed[l] = true;
      fixed[r] = true;
      pos[l] = 0;
      pos[r] = d;
    }
  }
  cout << "Yes\n";
  return 0;
}
