#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10 + 100000;
const int INF = int(1e9);
int n, m;
int l[MAXN], r[MAXN], q[MAXN];
void input() {
  ({
    int neg = 0;
    n = 0;
    char ch;
    for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
      if (ch == '-') neg = 1;
    n = ch - 48;
    for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar())
      n = (n << 3) + (n << 1) + (ch - 48);
    if (neg) n = -n;
  });
  ({
    int neg = 0;
    m = 0;
    char ch;
    for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
      if (ch == '-') neg = 1;
    m = ch - 48;
    for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar())
      m = (m << 3) + (m << 1) + (ch - 48);
    if (neg) m = -m;
  });
  for (int i = 1; i <= m; i++) {
    ({
      int neg = 0;
      l[i] = 0;
      char ch;
      for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
        if (ch == '-') neg = 1;
      l[i] = ch - 48;
      for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar())
        l[i] = (l[i] << 3) + (l[i] << 1) + (ch - 48);
      if (neg) l[i] = -l[i];
    });
    ({
      int neg = 0;
      r[i] = 0;
      char ch;
      for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
        if (ch == '-') neg = 1;
      r[i] = ch - 48;
      for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar())
        r[i] = (r[i] << 3) + (r[i] << 1) + (ch - 48);
      if (neg) r[i] = -r[i];
    });
    ({
      int neg = 0;
      q[i] = 0;
      char ch;
      for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
        if (ch == '-') neg = 1;
      q[i] = ch - 48;
      for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar())
        q[i] = (q[i] << 3) + (q[i] << 1) + (ch - 48);
      if (neg) q[i] = -q[i];
    });
  }
}
int getbit(int x, int k) { return (x >> k) & 1; }
int onbit(int x, int k) { return x | (1 << k); }
int ans[MAXN], sum[MAXN];
int f[MAXN * 4];
void update(int p, int l, int r) {
  if (l == r) {
    f[p] = ans[l];
    return;
  }
  int mid = (l + r) / 2;
  update(p * 2, l, mid);
  update(p * 2 + 1, mid + 1, r);
  f[p] = f[p * 2] & f[p * 2 + 1];
}
int get(int p, int l, int r, int a, int b) {
  if (r < a || b < l) return (1 << 30) - 1;
  if (a <= l && r <= b) return f[p];
  int mid = (l + r) / 2;
  int p1 = get(p * 2, l, mid, a, b);
  int p2 = get(p * 2 + 1, mid + 1, r, a, b);
  return p1 & p2;
}
void output() {
  for (int k = 0; k <= 30; k++) {
    memset(sum, 0, sizeof(sum));
    for (int i = 1; i <= m; i++)
      if (getbit(q[i], k)) {
        sum[l[i]]++;
        sum[r[i] + 1]--;
      }
    for (int i = 1; i <= n; i++) {
      sum[i] += sum[i - 1];
      if (sum[i] > 0) ans[i] = onbit(ans[i], k);
    }
  }
  update(1, 1, n);
  for (int i = 1; i <= m; i++) {
    if (get(1, 1, n, l[i], r[i]) != q[i]) {
      puts("NO");
      return;
    }
  }
  puts("YES");
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
}
int main() {
  input();
  output();
  return 0;
}
