#include <bits/stdc++.h>
using namespace std;
using LD = long double;
using VB = vector<bool>;
using WB = vector<VB>;
using VC = vector<char>;
using WC = vector<VC>;
using VI = vector<long long>;
using WI = vector<VI>;
using VD = vector<LD>;
using WD = vector<VD>;
using VS = vector<string>;
using WS = vector<VS>;
using PI = pair<long long, long long>;
using TI = tuple<long long, long long, long long>;
using VPI = vector<PI>;
using WPI = vector<VPI>;
bool debug;
void solve();
signed main(signed argc, char* argv[]) {
  debug = false;
  if (!debug) {
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
  cout << fixed << setprecision(20);
  cerr << fixed << setprecision(20);
  solve();
  return 0;
}
template <class T>
istream& operator>>(istream& s, vector<T>& v) {
  for (auto&& p : v) s >> p;
  return s;
}
template <class T>
ostream& operator<<(ostream& s, vector<T> v) {
  long long i = 0;
  for (const auto& p : v) s << (i++ ? " " : "") << p;
  return s;
}
template <class T>
ostream& operator<<(ostream& s, vector<vector<T>> w) {
  for (const auto& v : w) {
    long long i = 0;
    for (const auto& p : v) s << (i++ ? " " : "") << p;
    s << '\n';
  }
  return s;
}
template <class T>
T& RD(T& t) {
  cin >> t;
  return t;
}
template <class T, class... A>
T RD(A... a) {
  T t(a...);
  cin >> t;
  return t;
}
template <class T>
T max(const pair<T, T>& p) {
  return max(p.first, p.second);
}
template <class T>
T min(const pair<T, T>& p) {
  return min(p.first, p.second);
}
inline LD AC(LD d) { return d ? d : 0; }
constexpr long long INF = 1LL << 60;
constexpr long long MOD = 1000000009;
void solve() {
  long long N, M;
  cin >> N >> M;
  vector<TI> LRD(M);
  for (auto i0_to = (M), i = decltype(M)(0); i < i0_to; i++) {
    long long L, R, D;
    cin >> L >> R >> D;
    LRD[i] = TI{L, R, D};
  }
  VI x(N, -1);
  sort((LRD).begin(), (LRD).end());
  for (auto i0_to = (M), i = decltype(M)(0); i < i0_to; i++) {
    long long l, r, d;
    tie(l, r, d) = LRD[i];
    --l;
    --r;
    if (x[l] == -1) x[l] = 0;
    if (x[r] == -1) x[r] = x[l] + d;
    if (x[r] != x[l] + d) {
      cout << "No" << '\n';
      return;
    }
  }
  cout << "Yes" << '\n';
}
