#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27);
const ll INFLL = (1LL << 55);
template <typename T, typename U>
inline void chmax(T &x, U y) {
  if (x < y) x = y;
}
template <typename T, typename U>
inline void chmin(T &x, U y) {
  if (x > y) x = y;
}
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  if (m <= 1) {
    puts("Yes");
    return 0;
  }
  static int data[100010];
  fill(data, data + 100010, -INF);
  for (int(i) = (0); i < (int)(m); i++) {
    int l, r, d;
    scanf("%d%d%d", &l, &r, &d);
    if (data[l] == -INF && data[r] == -INF) {
      data[l] = 0;
      data[r] = d;
    } else if (data[r] == -INF) {
      data[r] = data[l] + d;
    } else if (data[l] == -INF) {
      data[l] = data[r] + d;
    } else {
      if (data[r] - data[l] != d) {
        puts("No");
        return 0;
      }
    }
  }
  puts("Yes");
  return 0;
}
