#include <bits/stdc++.h>
using namespace std;
const int INF = (int)(1 << 30);
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> L(M), R(M), D(M);
  vector<int> x(100010);
  for (int i = 0; i < M; ++i) {
    cin >> L[i] >> R[i] >> D[i];
  }
  for (int i = 0; i < 100010; ++i) {
    x[i] = INF;
  }
  for (int i = 0; i < M; ++i) {
    if (i == 0) {
      x[L[i]] = 0;
      x[R[i]] = x[L[i]] + D[i];
    } else {
      if (x[L[i]] != INF && x[R[i]] != INF) {
        if (x[L[i]] + D[i] != x[R[i]]) {
          cout << "No" << endl;
          return 0;
        }
      } else if (x[L[i]] != INF) {
        x[R[i]] = x[L[i]] + D[i];
      } else if (x[R[i]] != INF) {
        x[L[i]] = x[R[i]] - D[i];
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}
