Problem: You are given an undirected graph where each edge has one of two colors: black or red.

Your task is to assign a real number to each node so that: 

  * for each black edge the sum of values at its endpoints is 1; 
  * for each red edge the sum of values at its endpoints is 2; 
  * the sum of the absolute values of all assigned numbers is the smallest possible. 



Otherwise, if it is not possible, report that there is no feasible assignment of the numbers.

Input

The first line contains two integers N (1 ≤ N ≤ 100 000) and M (0 ≤ M ≤ 200 000): the number of nodes and the number of edges, respectively. The nodes are numbered by consecutive integers: 1, 2, …, N.

The next M lines describe the edges. Each line contains three integers a, b and c denoting that there is an edge between nodes a and b (1 ≤ a, b ≤ N) with color c (1 denotes black, 2 denotes red).

Output

If there is a solution, the first line should contain the word "YES" and the second line should contain N space-separated numbers. For each i (1 ≤ i ≤ N), the i-th number should be the number assigned to the node i.

Output should be such that: 

  * the sum of the numbers at the endpoints of each edge differs from the precise value by less than 10^{-6}; 
  * the sum of the absolute values of all assigned numbers differs from the smallest possible by less than 10^{-6}. 



If there are several valid solutions, output any of them.

If there is no solution, the only line should contain the word "NO".

Scoring

Subtasks: 

  1. (5 points) N ≤ 5, M ≤ 14 
  2. (12 points) N ≤ 100 
  3. (17 points) N ≤ 1000 
  4. (24 points) N ≤ 10 000 
  5. (42 points) No further constraints 

Examples

Input


4 4
1 2 1
2 3 2
1 3 2
3 4 1


Output


YES
0.5 0.5 1.5 -0.5


Input


2 1
1 2 1


Output


YES
0.3 0.7

Input


3 2
1 2 2
2 3 2


Output


YES
0 2 0


Input


3 4
1 2 2
2 2 1
2 1 1
1 2 2


Output


NO

Note

Note that in the second example the solution is not unique.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ull = uint64_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f64 = double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using ld = double;
namespace io {
const int BUFSIZE = 1 << 20;
int isize, osize;
char ibuf[BUFSIZE + 10], obuf[BUFSIZE + 10];
char *is, *it, *os = obuf, *ot = obuf + BUFSIZE;
char getchar() {
  if (is == it) {
    is = ibuf;
    it = ibuf + fread(ibuf, 1, BUFSIZE, stdin);
    if (is == it) return EOF;
  }
  return *is++;
}
char getalpha() {
  char c = getchar();
  while (!isalpha(c)) c = getchar();
  return c;
}
void putchar(char c) {
  *os++ = c;
  if (os == ot) {
    fwrite(obuf, 1, BUFSIZE, stdout);
    os = obuf;
  }
}
int inp() {
  int x = 0, f = 0;
  char ch;
  for (ch = getchar(); !isdigit(ch); ch = getchar()) {
    if (ch == EOF) return -1;
    if (ch == '-') f = 1;
  }
  for (; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  return f ? -x : x;
}
ll inp_ll() {
  ll x = 0;
  int f = 0;
  char ch;
  for (ch = getchar(); !isdigit(ch); ch = getchar())
    if (ch == '-') f = 1;
  for (; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  return f ? -x : x;
}
template <class T>
bool read(T& x) {
  x = 0;
  int f = 0;
  char ch;
  for (ch = getchar(); !isdigit(ch); ch = getchar()) {
    if (ch == EOF) return 0;
    if (ch == '-') f = 1;
  }
  for (; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  if (f) x = -x;
  return 1;
}
bool read(char* s) {
  char* t = s;
  char ch = getchar();
  for (; ch == ' ' || ch == '\n'; ch = getchar())
    ;
  for (; ch != ' ' && ch != '\n' && ch != EOF; ch = getchar()) *t++ = ch;
  *t = 0;
  return s != t;
}
template <class T, class... Args>
bool read(T& x, Args&... args) {
  return read(x) && read(args...);
}
template <class T>
bool readln(T& x) {
  x = 0;
  int f = 0;
  char ch;
  for (ch = getchar(); !isdigit(ch); ch = getchar()) {
    if (ch == EOF) return 0;
    if (ch == '-') f = 1;
  }
  for (; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  if (f) x = -x;
  for (; ch != '\n' && ch != EOF; ch = getchar())
    ;
  return 1;
}
bool readln(char* s) {
  char* t = s;
  while (1) {
    char ch = getchar();
    if (ch == '\n' || ch == EOF) break;
    *t++ = ch;
  }
  *t = 0;
  return s != t;
}
template <class T, class... Args>
bool readln(T& x, Args&... args) {
  return read(x) && readln(args...);
}
template <class T>
void write(T x) {
  static char s[22];
  static char* it = s + 20;
  static char* end = s + 20;
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  do {
    *--it = x % 10 + '0';
    x /= 10;
  } while (x);
  for (; it < end; ++it) putchar(*it);
}
void write(const char* s) {
  for (; *s; ++s) putchar(*s);
}
template <>
void write(char* s) {
  write((const char*)s);
}
template <>
void write(char c) {
  putchar(c);
}
template <class T, class... Args>
void write(T x, Args... args) {
  write(x);
  write(args...);
}
void writeln() { putchar('\n'); }
template <class T, class... Args>
void writeln(T x, Args... args) {
  write(x);
  writeln(args...);
}
template <class Iterator>
bool input(Iterator st, Iterator ed) {
  for (; st != ed; ++st) {
    if (!read(*st)) return false;
  }
  return true;
}
template <class T>
bool input(T& a) {
  return input(a.begin(), a.end());
}
template <class Iterator>
void print(Iterator st, Iterator ed, const char* c = " ") {
  int flag = 0;
  for (; st != ed; ++st) {
    if (flag) write(c);
    flag = 1;
    write(*st);
  }
  writeln();
}
template <class T>
void print(const T& a, const char* c = " ") {
  print(a.begin(), a.end(), c);
}
struct ender {
  ~ender() {
    if (os != obuf) fwrite(obuf, 1, os - obuf, stdout);
  }
} __ender;
}  // namespace io
int64_t power(int64_t a, int64_t b, int64_t p) {
  if (!b) return 1;
  int64_t t = power(a, b >> 1, p);
  t = t * t % p;
  if (b & 1) t = t * a % p;
  return t;
}
pll exgcd(ll a, ll b) {
  if (b == 0) return {1, 0};
  auto e = exgcd(b, a % b);
  ll x = e.first;
  ll y = e.second;
  return {y, x - a / b * y};
}
mt19937 rd(1);
using namespace io;
template <class T>
inline void freshmin(T& a, const T& b) {
  if (a > b) a = b;
}
template <class T>
inline void freshmax(T& a, const T& b) {
  if (a < b) a = b;
}
const int INF = 1000000010;
const ll INFll = 4000000000000000000LL;
const int MAXN = 600010;
const int MAXK = 21;
int dx[] = {-1, 1, 0, 0, -1, -1, 1, 1};
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
template <class T>
T det(T x1, T y1, T x2, T y2, T x3, T y3) {
  return x1 * y2 - x2 * y1 + x2 * y3 - x3 * y2 + x3 * y1 - x1 * y3;
}
template <class T>
T dis(T x1, T y1, T x2, T y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
void init() {}
void solve() {
  int n, m;
  read(n, m);
  vector<vector<pii>> v(n);
  for (int i = 0; i < m; ++i) {
    int a, b, c;
    read(a, b, c);
    a -= 1;
    b -= 1;
    v[a].push_back({b, c});
    v[b].push_back({a, c});
  }
  vector<int> u(n);
  struct node {
    ll a, b;
  };
  vector<node> res(n);
  vector<ld> ans(n);
  for (int i = 0; i < n; ++i) {
    if (u[i]) continue;
    u[i] = 1;
    res[i] = {1, 0};
    int no_answer = 0;
    int found = 0;
    ld val = 0;
    vector<int> p;
    function<void(int)> dfs = [&](int x) {
      if (no_answer || found) return;
      p.push_back(x);
      for (auto [y, z] : v[x]) {
        if (u[y]) {
          node tmp = {-res[x].a, z - res[x].b};
          if (res[y].a == tmp.a) {
            if (res[y].b != tmp.b) {
              no_answer = 1;
              return;
            }
          } else {
            found = 1;
            val = ld(tmp.b - res[y].b) / (res[y].a - tmp.a);
            return;
          }
        } else {
          u[y] = 1;
          res[y] = {-res[x].a, z - res[x].b};
          dfs(y);
        }
      }
    };
    dfs(i);
    if (no_answer) {
      writeln("NO");
      return;
    }
    if (!found) {
      vector<ld> tmp;
      for (auto x : p) {
        tmp.push_back(ld(-res[x].b) / (res[x].a));
      }
      sort(tmp.begin(), tmp.end());
      val = tmp[tmp.size() / 2];
    }
    const ld eps = 1e-8;
    function<void(int, ld)> dfs2 = [&](int x, ld val) {
      u[x] = 2;
      ans[x] = val;
      for (auto [y, z] : v[x]) {
        if (u[y] != 2)
          dfs2(y, z - ans[x]);
        else {
          if (fabs(ans[y] - (z - ans[x])) > eps) {
            no_answer = 1;
          }
        }
      }
    };
    dfs2(i, val);
    if (no_answer) return writeln("NO");
  }
  writeln("YES");
  for (auto c : ans) {
    char buf[33];
    sprintf(buf, "%.8f", c);
    write(buf, ' ');
  }
}
int main() {
  int T = 1;
  init();
  for (int test = 1; test <= T; ++test) {
    solve();
  }
  return 0;
}