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