#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
constexpr long long MMOD = 500000004;
const double PI = acos(-1);
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
vector<pair<int, int>> G[101010];
int l[202020], r[202020], d[202020];
bool used[101010];
int pos[101010];
int n, m;
int main() {
  cin >> n >> m;
  for (int i = (0); i < (m); i++) {
    cin >> l[i] >> r[i] >> d[i];
    l[i]--, r[i]--;
    G[l[i]].emplace_back(make_pair(r[i], d[i]));
  }
  for (int i = (0); i < (n); i++) pos[i] = INF;
  bool first = false;
  for (int i = (0); i < (n); i++) {
    used[i] = true;
    for (int j = (0); j < (G[i].size()); j++) {
      if (pos[G[i][j].first] == INF) {
        if (!first) pos[i] = 0, first = true;
        pos[G[i][j].first] = pos[i] + G[i][j].second;
      } else if (pos[G[i][j].first] != pos[i] + G[i][j].second) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}
