#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
vector<pair<int, int> > e[N];
int vis[N], q[N];
int k[N], b[N];
int n, m, v1, v2, ans[N], c[N];
void dfs(int x) {
  vis[x] = 1;
  q[++*q] = x;
  for (auto i : e[x])
    if (!vis[i.first]) {
      k[i.first] = -k[x];
      b[i.first] = i.second - b[x];
      dfs(i.first);
    } else if (k[i.first] + k[x] == 0) {
      if (b[i.first] + b[x] != i.second) v2 = -1;
    } else {
      int res = (i.second - b[i.first] - b[x]);
      res /= k[i.first] + k[x];
      if (!v2)
        v2 = 1, v1 = res;
      else if (v1 != res)
        v2 = -1;
    }
}
void solve(int x) {
  v1 = 0;
  v2 = 0;
  *q = 0;
  k[x] = 1;
  b[x] = 0;
  dfs(x);
  if (v2 == -1) {
    puts("NO");
    exit(0);
  }
  if (v2 == 0) {
    for (int i = (int)(1); i <= (int)(*q); i++) c[i] = b[q[i]] * k[q[i]];
    sort(c + 1, c + *q + 1);
    v1 = -c[(*q + 1) / 2];
  }
  for (int i = (int)(1); i <= (int)(*q); i++)
    ans[q[i]] = k[q[i]] * v1 + b[q[i]];
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (int)(1); i <= (int)(m); i++) {
    int x, y, v;
    scanf("%d%d%d", &x, &y, &v);
    e[x].push_back(pair<int, int>(y, v * 2));
    e[y].push_back(pair<int, int>(x, v * 2));
  }
  for (int i = (int)(1); i <= (int)(n); i++)
    if (!vis[i]) solve(i);
  puts("YES");
  for (int i = (int)(1); i <= (int)(n); i++) {
    if (ans[i] < 0) printf("-"), ans[i] *= -1;
    printf("%d.%d ", ans[i] / 2, ans[i] % 2 * 5);
  }
}
