#include <bits/stdc++.h>
using namespace std;
int arr[100005];
int main() {
  int n, m;
  int l, r, d;
  int flag = 1;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> l >> r >> d;
    if ((arr[r] != 0) && (flag)) {
      if (arr[r] != arr[l] + d) cout << "No" << endl;
      flag = 0;
    } else if (flag) {
      arr[r] = arr[l] + d;
    }
  }
  if (flag) {
    cout << "Yes" << endl;
  }
  return 0;
}
