#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N], b[N], s[N];
int st[N], tp;
int xx;
bool f;
bool vis[N];
double ans[N];
struct edge {
  int v, w;
  edge(int x, int y) { v = x, w = y; }
};
vector<edge> e[N];
void dfs(int u) {
  st[++tp] = u;
  vis[u] = 1;
  for (auto x : e[u]) {
    int v = x.v, w = x.w;
    if (vis[v]) {
      if (a[u] + a[v] == 0 && b[u] + b[v] != w) {
        printf("NO\n");
        exit(0);
      }
      if (a[u] + a[v] != 0) {
        int nx = (w - b[u] - b[v]) / (a[u] + a[v]);
        if (f && nx != xx) {
          printf("NO\n");
          exit(0);
        }
        xx = nx;
        f = 1;
      }
    } else {
      a[v] = -a[u];
      b[v] = w - b[u];
      dfs(v);
    }
  }
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    w <<= 1;
    e[u].push_back(edge(v, w));
    e[v].push_back(edge(u, w));
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    a[i] = 1, b[i] = 0;
    tp = 0;
    f = 0;
    dfs(i);
    if (!f) {
      for (int i = 1; i <= tp; i++) {
        s[i] = -b[st[i]] / a[st[i]];
      }
      sort(s + 1, s + tp + 1);
      xx = s[(1 + tp) >> 1];
    }
    for (int i = 1; i <= tp; i++) {
      ans[st[i]] = 1.0 * a[st[i]] * xx + b[st[i]];
      ans[st[i]] /= 2;
    }
  }
  printf("YES\n");
  for (int i = 1; i <= n; i++) {
    printf("%.1f%c", ans[i], i == n ? '\n' : ' ');
  }
  return 0;
}
