#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) {
  if (x == 0) return y;
  return gcd(y % x, x);
}
long long powmod(long long x, long long y, long long m) {
  if (y == 0) return 1;
  long long p = powmod(x, y / 2, m) % m;
  p = (p * p) % m;
  return (y % 2 == 0) ? p : (x * p) % m;
}
long long mul_inv(long long a, long long b) {
  long long b0 = b, t, q;
  long long x0 = 0ll, x1 = 1ll;
  if (b == 1ll) return 1ll;
  while (a > 1ll) {
    q = a / b;
    t = b, b = a % b, a = t;
    t = x0, x0 = x1 - q * x0, x1 = t;
  }
  if (x1 < 0ll) x1 += b0;
  return x1;
}
bool fa(vector<long long> &x, vector<long long> &y) { return x[0] < y[0]; }
bool fa1(vector<long long> &x, vector<long long> &y) { return x[1] < y[1]; }
bool f1(pair<long long, long long> &x, pair<long long, long long> &y) {
  return x.second > y.second;
}
bool f2(pair<long long, long long> &x, pair<long long, long long> &y) {
  return x.first > y.first;
}
bool f3(long long &x, long long &y) { return x > y; }
const long long maxn = 1e4 + 10;
bool meow1(vector<long long> &x, vector<long long> &y) { return x[3] < y[3]; }
bool meow2(vector<long long> &x, vector<long long> &y) { return x[2] < y[2]; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long m;
  cin >> m;
  vector<array<long long, 3> > b(m);
  long long c[n + 1][31];
  long long d[n + 1][31];
  long long f[n + 1][31];
  long long ans[n];
  for (int i = 0; i < n; i++) ans[i] = 0;
  for (int i = 0; i < n + 1; i++) {
    for (int t = 0; t < 31; t++) {
      c[i][t] = 0;
      d[i][t] = 0;
      f[i][t] = 0;
    }
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i][0] >> b[i][1] >> b[i][2];
    b[i][0]--;
    long long x = b[i][2];
    long long it = 0;
    while (x) {
      c[b[i][0]][it] += x % 2ll;
      c[b[i][1]][it] -= x % 2ll;
      x /= 2ll;
      it++;
    }
  }
  for (long long i = 0; i <= n; i++) {
    for (int t = 0; t < 31; t++) {
      if (i > 0) c[i][t] += c[i - 1][t];
      if (c[i][t] > 0) {
        ans[i] += pow(2ll, t);
        d[i][t]++;
      }
    }
  }
  for (int i = 0; i < n + 1; i++) {
    for (int t = 0; t < 31; t++) {
      f[i + 1][t] = f[i][t] + d[i][t];
    }
  }
  long long ch = 0;
  for (int i = 0; i < m; i++) {
    long long len = b[i][1] - b[i][0];
    for (int t = 0; t < 31; t++) {
      if ((((1ll << t) & b[i][2]) == (1ll << t)) !=
          (f[b[i][1]][t] - f[b[i][0]][t] == len)) {
        ch++;
        break;
      }
    }
  }
  if (ch) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
    for (auto x : ans) cout << x << " ";
    cout << "\n";
  }
  return 0;
}
