#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <memory.h>
#include <cassert>
using namespace std;
const int N = 200010;
int from[N], to[N], num[N];
int s[N][30];
int a[N][30];
int sum[N][30];
int main() {
int n, m;
scanf("%d %d", &n, &m);
for (int i = 0; i <= n; i++) {
for (int j = 0; j < 30; j++) {
s[i][j] = 0;
}
}
for (int k = 0; k < m; k++) {
scanf("%d %d %d", from + k, to + k, num + k);
from[k]--; to[k]--;
for (int j = 0; j < 30; j++) {
if (num[k] & (1 << j)) {
s[from[k]][j]++;
s[to[k] + 1][j]--;
}
}
}
for (int j = 0; j < 30; j++) {
int bal = 0;
sum[0][j] = 0;
for (int i = 0; i < n; i++) {
bal += s[i][j];
a[i][j] = (bal > 0);
sum[i + 1][j] = sum[i][j] + a[i][j];
}
}
for (int k = 0; k < m; k++) {
for (int j = 0; j < 30; j++) {
if (!(num[k] & (1 << j))) {
int get = sum[to[k] + 1][j] - sum[from[k]][j];
int need = (to[k] + 1) - (from[k]);
if (get == need) {
puts("NO");
return 0;
}
}
}
}
puts("YES");
for (int i = 0; i < n; i++) {
int res = 0;
for (int j = 0; j < 30; j++) {
if (a[i][j]) {
res += (1 << j);
}
}
if (i > 0) printf(" ");
printf("%d", res);
}
printf("\n");
return 0;
}
I2luY2x1ZGUgPGNzdHJpbmc+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxsaXN0PgojaW5jbHVkZSA8bWFwPgojaW5jbHVkZSA8c2V0PgojaW5jbHVkZSA8ZGVxdWU+CiNpbmNsdWRlIDxzdGFjaz4KI2luY2x1ZGUgPGJpdHNldD4KI2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGZ1bmN0aW9uYWw+CiNpbmNsdWRlIDxudW1lcmlj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sID4gMCk7CiAgICAgIHN1bVtpICsgMV1bal0gPSBzdW1baV1bal0gKyBhW2ldW2pdOwogICAgfQogIH0KICBmb3IgKGludCBrID0gMDsgayA8IG07IGsrKykgewogICAgZm9yIChpbnQgaiA9IDA7IGogPCAzMDsgaisrKSB7CiAgICAgIGlmICghKG51bVtrXSAmICgxIDw8IGopKSkgewogICAgICAgIGludCBnZXQgPSBzdW1bdG9ba10gKyAxXVtqXSAtIHN1bVtmcm9tW2tdXVtqXTsKICAgICAgICBpbnQgbmVlZCA9ICh0b1trXSArIDEpIC0gKGZyb21ba10pOwogICAgICAgIGlmIChnZXQgPT0gbmVlZCkgewogICAgICAgICAgcHV0cygiTk8iKTsKICAgICAgICAgIHJldHVybiAwOwogICAgICAgIH0KICAgICAgfQogICAgfQogIH0KICBwdXRzKCJZRVMiKTsKICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgewogICAgaW50IHJlcyA9IDA7CiAgICBmb3IgKGludCBqID0gMDsgaiA8IDMwOyBqKyspIHsKICAgICAgaWYgKGFbaV1bal0pIHsKICAgICAgICByZXMgKz0gKDEgPDwgaik7CiAgICAgIH0KICAgIH0KICAgIGlmIChpID4gMCkgcHJpbnRmKCIgIik7CiAgICBwcmludGYoIiVkIiwgcmVzKTsKICB9CiAgcHJpbnRmKCJcbiIpOwogIHJldHVybiAwOwp9