#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
int n, m;
map<int, long long> mss;
int l[maxn], r[maxn], d[maxn];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) mss[i] = 0;
  for (int i = 1; i <= m; i++) {
    cin >> l[i] >> r[i] >> d[i];
    mss[r[i]] = mss[l[i]] + d[i];
  }
  for (int i = 1; i <= m; i++) {
    if (mss[r[i]] - mss[l[i]] != d[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}
