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