#include <bits/stdc++.h>
using namespace std;
int n, m;
int x[100005];
int l[100005];
int r[100005];
int d[100005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  memset(x, -1, sizeof(x));
  x[1] = 1;
  cin >> n >> m;
  int a, b;
  for (int i = 1; i <= m; i++) {
    cin >> a >> b;
    l[i] = min(a, b);
    r[i] = max(a, b);
    cin >> d[i];
    if (x[r[i]] != -1) {
      if (l[i] + d[i] != x[i]) {
        cout << "No";
        return 0;
      }
    } else {
      x[r[i]] = l[i] + d[i];
    }
  }
  cout << "Yes";
  return 0;
}
