#include <bits/stdc++.h>
using namespace std;
int vis[100010];
int main() {
  int n, m;
  while (~scanf("%d%d", &n, &m)) {
    if (m == 0) {
      cout << "Yes" << endl;
      return 0;
    }
    memset(vis, -1, sizeof(vis));
    int a, b, t;
    scanf("%d%d%d", &a, &b, &t);
    vis[a] = 0;
    vis[b] = vis[a] + t;
    bool flag = true;
    for (int i = 1; i < m; i++) {
      scanf("%d%d%d", &a, &b, &t);
      int ans = a + t;
      if (vis[b] != -1 && vis[b] != ans) {
        flag = false;
      } else {
        vis[b] = ans;
      }
    }
    if (flag)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}
