#include <bits/stdc++.h>
using namespace std;
long long int Lpow(long long int a, long long int b) {
  long long int ans = 1;
  while (b > 0) {
    if (b % 2) ans = (ans * a);
    a = (a * a);
    b = b / 2;
  }
  return ans;
}
long long int gcd(long long int a, long long int b) {
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
const int N = 1000 * 1000;
const int MAXBIT = 30;
int l[N], r[N], q[N], a[N], t[4 * N];
int sum[N];
inline void build(int v, int l, int r) {
  if (l + 1 == r) {
    t[v] = a[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(v * 2, l, mid);
  build(v * 2 + 1, mid, r);
  t[v] = t[v * 2] & t[v * 2 + 1];
}
inline int query(int v, int l, int r, int L, int R) {
  if (l == L && r == R) {
    return t[v];
  }
  int mid = (L + R) >> 1;
  int ans = (1ll << MAXBIT) - 1;
  if (l < mid) ans &= query(v * 2, l, std::min(r, mid), L, mid);
  if (mid < r) ans &= query(v * 2 + 1, std::max(l, mid), r, mid, R);
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> l[i] >> r[i] >> q[i];
    l[i]--;
  }
  for (int bit = 0; bit <= MAXBIT; bit++) {
    for (int i = 0; i < n; i++) sum[i] = 0;
    for (int i = 0; i < m; i++) {
      if ((q[i] >> bit) & 1) {
        sum[l[i]]++;
        sum[r[i]]--;
      }
    }
    for (int i = 0; i < n; i++) {
      if (i > 0) sum[i] += sum[i - 1];
      if (sum[i] > 0) {
        a[i] |= (1 << bit);
      }
    }
  }
  build(1, 0, n);
  for (int i = 0; i < m; i++) {
    if (query(1, l[i], r[i], 0, n) != q[i]) {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  cout << '\n';
  return 0;
}
