#include <bits/stdc++.h>
using namespace std;
int poo(int a, int b) {
  long long int x = 1, y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y);
    }
    y = (y * y);
    b /= 2;
  }
  return x;
}
int p[32], fck[100005][32], pre[100005][32], val[100005];
vector<pair<int, int> > v[32], chd;
vector<int> ans;
int main() {
  int n, m, i, j, k;
  int sum = 0, x, y, q, st, en;
  scanf("%d", &n);
  scanf("%d", &m);
  for (i = 0; i < n; i++) {
    for (j = 0; j < 32; j++) {
      fck[i][j] = 0;
    }
  }
  for (i = 0; i < m; i++) {
    scanf("%d", &x);
    scanf("%d", &y);
    scanf("%d", &q);
    for (k = 0; k < 32; k++) {
      p[k] = 0;
    }
    k = 0;
    x--;
    y--;
    chd.push_back(make_pair(x, y));
    val[i] = q;
    while (q) {
      if (q & 1 == 1) {
        p[k] = 1;
      }
      q /= 2;
      k++;
    }
    for (k = 0; k < 32; k++) {
      if (p[k] == 1) {
        v[k].push_back(make_pair(x, y));
      }
    }
  }
  for (i = 0; i < 32; i++) {
    sort(v[i].begin(), v[i].end());
  }
  for (i = 0; i < 32; i++) {
    st = 0;
    en = -1;
    if (v[i].size()) {
      st = v[i][0].first;
      en = v[i][0].second;
    }
    for (j = 0; j < v[i].size(); j++) {
      if (j == 0) {
        continue;
      }
      if (v[i][j].first > en) {
        for (k = st; k <= en; k++) {
          fck[k][i] = 1;
        }
        st = v[i][j].first;
        en = v[i][j].second;
      } else {
        if (v[i][j].second > en) {
          en = v[i][j].second;
        }
      }
    }
    for (k = st; k <= en; k++) {
      fck[k][i] = 1;
    }
  }
  for (i = 0; i < n; i++) {
    sum = 0;
    for (j = 0; j < 32; j++) {
      if (fck[i][j] == 1) {
        sum += poo(2, j);
      }
    }
    ans.push_back(sum);
  }
  for (i = 0; i < 32; i++) {
    st = -1;
    for (j = 0; j < n; j++) {
      if (fck[j][i] == 0) {
        st = j;
        pre[j][i] = n + 1;
      } else {
        pre[j][i] = st;
      }
    }
  }
  for (i = 0; i < chd.size(); i++) {
    for (k = 0; k < 32; k++) {
      p[k] = 0;
    }
    k = 0;
    q = val[i];
    x = chd[i].first;
    y = chd[i].second;
    while (q) {
      if (q & 1 == 1) {
        p[k] = 1;
      }
      q /= 2;
      k++;
    }
    for (k = 0; k < 32; k++) {
      if (p[k] == 0) {
        if (pre[y][k] + 1 <= x) {
          cout << "NO";
          return 0;
        }
      }
    }
  }
  cout << "YES";
  printf("\n");
  for (i = 0; i < ans.size(); i++) {
    printf("%d", ans[i]);
    printf(" ");
  }
  return 0;
}
