#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int)1e5 + 5;
int n, m, t, xx, arr[MAXN], crr[MAXN], ans[MAXN];
vector<pair<int, int> > vc[MAXN];
bool visit[MAXN], q;
int a[MAXN], b[MAXN];
void End(void) {
  puts("NO");
  exit(0);
}
void dfs(int node) {
  visit[node] = true, arr[++t] = node;
  for (pair<int, int> each : vc[node]) {
    if (visit[each.first]) {
      if (a[node] + a[each.first] == 0 &&
          b[node] + b[each.first] != each.second)
        End();
      if (a[node] + a[each.first] != 0) {
        int x =
            (each.second - b[node] - b[each.first]) / (a[node] + a[each.first]);
        if (q) {
          if (x != xx) End();
        } else
          q = true, xx = x;
      }
    } else {
      a[each.first] = -a[node], b[each.first] = each.second - b[node];
      dfs(each.first);
    }
  }
}
int main(void) {
  scanf("%d %d", &n, &m);
  while (m--) {
    int u, v, w;
    scanf("%d %d %d", &u, &v, &w);
    w *= 2;
    vc[u].push_back(make_pair(v, w));
    vc[v].push_back(make_pair(u, w));
  }
  for (int i = 1; i <= n; i++) {
    if (visit[i]) continue;
    a[i] = 1, b[i] = 0, q = false, t = 0;
    dfs(i);
    if (!q) {
      for (int j = 1; j <= t; j++) crr[j] = -1 * b[arr[j]] / a[arr[j]];
      sort(crr + 1, crr + t + 1);
      xx = crr[(t + 1) / 2];
    }
    for (int j = 1; j <= t; j++) ans[arr[j]] = xx * a[arr[j]] + b[arr[j]];
  }
  puts("YES");
  for (int i = 1; i <= n; i++) printf("%.7f ", ans[i] / 2.0);
  return 0;
}
