#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
long long int N, M, K, H, W, L, R;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> M;
  vector<int> dis(N + 1, -1);
  for (int i = 0; i < M; i++) {
    cin >> L >> R >> K;
    if (dis[L] == -1 && dis[R] == -1) {
      dis[L] = 0;
      dis[R] = K;
    } else if (dis[L] == -1) {
      dis[L] = dis[R] - K;
    } else if (dis[R] == -1) {
      dis[R] = dis[L] + K;
    } else {
      if (dis[R] - dis[L] != K) {
        cout << "No\n";
        return 0;
      }
    }
  }
  cout << "Yes\n";
  return 0;
}
