#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int c[m][3];
  long long int t = 0;
  for (long long int i = 0; i < m; i++) {
    cin >> c[i][0];
    cin >> c[i][1];
    cin >> c[i][2];
  }
  long long int b[n];
  for (long long int i = 0; i < n; i++) {
    b[i] = 0;
  }
  b[c[0][0] - 1] = 0;
  for (long long int q = 0; q < m; q++) {
    b[c[q][1] - 1] = b[c[q][0] - 1] + c[q][2];
  }
  for (long long int q = 0; q < m; q++) {
    if (b[c[q][1] - 1] != b[c[q][0] - 1] + c[q][2]) {
      cout << "No";
      t = 1;
      break;
    }
  }
  long long int r = INT_MIN;
  long long int y = INT_MAX;
  for (long long int q = 0; q < m; q++) {
    if (b[q] < y) {
      y = b[q];
    }
    if (b[q] > r) {
      r = b[q];
    }
  }
  if (r - y > 1000000000) {
    cout << "No";
    t = 1;
  }
  if (t == 0) {
    cout << "Yes";
  }
  system("pause");
  return 0;
}
