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