#include <bits/stdc++.h>   using namespace std;   mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());   #pragma GCC optimize( Ofast )   #pragma GCC optimize( -O3 )   #pragma GCC optmize( sse, sse2, sse3, sse4, avx, abx, avx2, sse4.1 )   #pragma GCC optmize( fast-math )   #pragma GCC optimize( unroll-loops )   const int N = 1e5 + 100;   const int INF = 1e9;   vector<pair<int, int>> g[N];   int res[N];   bool used[N];   int col[N];   vector<int> comp;   int h[N];   void ex() {     cout <<  NO ;     exit(0);   }   void dfs(int v) {     comp.push_back(v);     used[v] = true;     for (auto u : g[v]) {       if (!used[u.first]) {         h[u.first] = h[v] + 1;         dfs(u.first);       }     }   }   void push(int v) {     for (auto u : g[v]) {       if (res[u.first] == INF) {         res[u.first] = u.second - res[v];         push(u.first);       }     }   }   vector<pair<int, int>> p;   int eat[N];   bool bfs(int st) {     vector<int> q;     q.push_back(st);     int ptr = 0;     int v1 = -1;     int v2 = -1;     int last = 0;     while (ptr < q.size() && v1 == -1) {       int v = q[ptr++];       for (auto u : g[v]) {         if (u.first == p[v].first) continue;         if (p[u.first].first == -1 && u.first != st) {           col[u.first] = 1 - col[v];           p[u.first].first = v;           p[u.first].second = u.second;           q.push_back(u.first);         } else if (col[u.first] == col[v]) {           v1 = v;           v2 = u.first;           last = u.second;           break;         }       }     }     if (v1 == -1) return false;     vector<int> p1;     vector<int> d1;     int bv1 = v1;     while (v1 != -1) {       p1.push_back(v1);       if (p[v1].first != -1) d1.push_back(p[v1].second);       v1 = p[v1].first;     }     vector<int> p2;     vector<int> d2;     while (p[v2].first != -1) {       p2.push_back(v2);       d2.push_back(p[v2].second);       v2 = p[v2].first;     }     reverse(p2.begin(), p2.end());     reverse(d2.begin(), d2.end());     for (int &x : d2) d1.push_back(x);     for (int &i : p2) p1.push_back(i);     int s = 0;     int sgn = 1;     for (int i = (int)d1.size() - 1; i >= 0; --i) {       s += (sgn * d1[i]);       sgn *= (-1);     }     res[bv1] = (last - s) / 2;     push(bv1);     return true;   }   void iterate(int v) {     res[v] = 0;     push(v);     vector<int> s;     for (int &i : comp) {       if (h[i] % 2 == 0)         s.push_back(res[i]);       else         s.push_back(-res[i]);     }     sort(s.begin(), s.end());     for (int &i : comp) res[i] = INF;     res[v] = -s[s.size() / 2];     push(v);   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie();     cout.tie();     ;     cout.precision(18);     int n, m;     cin >> n >> m;     auto cmp = [](pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {       if (a.first != b.first) return a.first < b.first;       return a.second < b.second;     };     set<pair<pair<int, int>, int>, decltype(cmp)> s(cmp);     fill(res, res + n, INF);     vector<pair<pair<int, int>, int>> que;     for (int i = 0; i < m; ++i) {       int a, b, c;       cin >> a >> b >> c;       que.push_back({{a - 1, b - 1}, c * 2});       if (a == b) {         res[--b] = c;         continue;       }       if (s.count({{a, b}, c}) || s.count({{b, a}, c})) continue;       int f1 = 1;       if (c == 1) f1 = 2;       if (s.count({{a, b}, f1}) || s.count({{b, a}, f1})) ex();       s.insert({{a, b}, c});       g[--a].push_back({--b, c * 2});       g[b].push_back({a, c * 2});     }     fill(used, used + n, false);     fill(col, col + n, 0);     p.resize(n, {-1, 0});     for (int i = 0; i < n; ++i) {       for (auto z : g[i]) eat[i] += z.second;     }     for (int i = 0; i < n; ++i) {       if (!used[i]) {         comp.clear();         dfs(i);         int id = -1;         for (int &j : comp) {           if (res[j] != INF) id = j;         }         if (id != -1) {           push(id);           continue;         }         bool f = bfs(i);         if (f) continue;         iterate(i);       }     }     for (auto z : que) {       if (res[z.first.first] + res[z.first.second] != z.second) ex();     }     cout <<  YES n ;     for (int i = 0; i < n; ++i) cout << ((double)res[i] / 2.0) <<    ;   }