#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MAX = 1e5 + 10;
const ll INF = 1e18;
const int MOD = 1e9 + 7;
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
ll x[MAX];
int main() {
  int N, M;
  cin >> N >> M;
  int L[M], R[M], D[M];
  for (int i = 0; i < M; i++) cin >> L[i] >> R[i] >> D[i];
  fill(x, x + MAX, INF);
  bool flag = true;
  for (int i = 0; i < M; i++) {
    if (x[L[i]] == INF && x[R[i]] == INF) {
      x[L[i]] = 0;
      x[R[i]] = D[i];
    } else if (x[L[i]] == INF) {
      x[L[i]] = x[R[i]] - D[i];
    } else if (x[R[i]] == INF) {
      x[R[i]] = x[L[i]] + D[i];
    } else {
      if (llabs(x[R[i]] - x[L[i]]) != D[i]) {
        flag = false;
        break;
      }
    }
  }
  cout << (flag ? "Yes" : "No") << endl;
  return 0;
}
