#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e5+100;
typedef long long LL;
LL l[maxn],r[maxn],p[maxn],n,m;
struct SeamentTree{
	LL l,r,add,val;
}tree[maxn*4];
void build(LL p,LL l,LL r)
{
	tree[p].l=l;tree[p].r=r;
	if(l==r){tree[p].val=0;return;}
	LL mid=(l+r)/2;
	build(p*2,l,mid);
	build(p*2+1,mid+1,r);
	tree[p].val=tree[p*2].val=tree[p*2+1].val=0;
}
void spread(LL p)
{
	if(tree[p].add)
	{
	   tree[p*2].val|=tree[p].val;
	   tree[p*2+1].val|=tree[p].val;
	   tree[p*2].add+=tree[p].add;
	   tree[p*2+1].add+=tree[p].add;
	   tree[p].add=0;
	}
}
void change(LL p,LL l,LL r,LL d)
{
	if(l<=tree[p].l&&r>=tree[p].r)
	{
		tree[p].val|=d;
		tree[p].add|=d;
		return;
	}
	spread(p);
	LL mid=(tree[p].l+tree[p].r)/2;
	if(l<=mid) change(p*2,l,mid,d);
	if(r>mid) change(p*2+1,mid+1,r,d);
	tree[p].val|=tree[p*2].val;tree[p].val|=tree[p*2+1].val;
}
LL query(LL p,LL l,LL r)
{
	if(l<=tree[p].l&&r>=tree[p].r) return tree[p].val;
	spread(p);
	LL mid=(tree[p].l+tree[p].r)/2;
	LL res=0x3f3f3f3f3f;
	if(l<=mid) res&=query(p*2,l,r);
	if(r>mid) res&=query(p*2+1,l,r);
	return res;
}
bool judge()
{
//	for(LL i=1;i<=n;i++){
//		cout<<query(1,i,i)<<" ";
//	}
	for(LL i=1;i<=m;i++)
	{
	//	cout<<query(1,l[i],r[i])<<endl;
		if(query(1,l[i],r[i])!=p[i]) return true;
	}
	cout<<"YES"<<endl;
	for(LL i=1;i<n;i++){
		cout<<query(1,i,i)<<" ";
	}
	cout<<query(1,n,n)<<endl;
	return false;
}
int main(void)
{
  cin.tie(0);std::ios::sync_with_stdio(false);
  cin>>n>>m;
  build(1,1,n);
  for(LL i=1;i<=m;i++)
  {
	 cin>>l[i]>>r[i]>>p[i];
	 change(1,l[i],r[i],p[i]);
  }
  if(judge()) cout<<"NO"<<endl;
return 0;
}


#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e5+100;
typedef long long LL;
LL l[maxn],r[maxn],p[maxn],n,m;
struct SeamentTree{
	LL l,r,add,val;
}tree[maxn*4];
void pushup(LL p)
{
	tree[p].val=tree[p*2].val&tree[p*2+1].val;
}
void spread(LL p)
{
	if(tree[p].add)
	{
	   tree[p*2].val|=tree[p].val;
	   tree[p*2+1].val|=tree[p].val;
	   tree[p*2].add|=tree[p].add;
	   tree[p*2+1].add|=tree[p].add;
	   tree[p].add=0;
	}
}
void build(LL p,LL l,LL r)
{
	tree[p].l=l;tree[p].r=r;
	if(l==r){tree[p].val=0;return;}
	LL mid=(l+r)/2;
	build(p*2,l,mid);
	build(p*2+1,mid+1,r);
	pushup(p);
}
void change(LL p,LL l,LL r,LL d)
{
	if(l<=tree[p].l&&r>=tree[p].r)
	{
		tree[p].val|=d;
		tree[p].add|=d;
		return;
	}
	spread(p);
	LL mid=(tree[p].l+tree[p].r)/2;
	if(l<=mid) change(p*2,l,mid,d);
	if(r>mid) change(p*2+1,mid+1,r,d);
	pushup(p);
}
LL query(LL p,LL l,LL r)
{
	if(l<=tree[p].l&&r>=tree[p].r) return tree[p].val;
	spread(p);
	LL mid=(tree[p].l+tree[p].r)/2;
	LL res=1e17;
	if(l<=mid) res&=query(p*2,l,r);
	if(r>mid) res&=query(p*2+1,l,r);
	return res;
}
bool judge()
{

	for(LL i=1;i<=m;i++)
	{
		if(query(1,l[i],r[i])!=p[i]) return true;
	}
	cout<<"YES"<<endl;
	for(LL i=1;i<n;i++){
		cout<<query(1,i,i)<<" ";
	}
	cout<<query(1,n,n)<<endl;
	return false;
}
int main(void)
{
  cin.tie(0);std::ios::sync_with_stdio(false);
  cin>>n>>m;
  build(1,1,n);
  for(LL i=1;i<=m;i++)
  {
	 cin>>l[i]>>r[i]>>p[i];
	 change(1,l[i],r[i],p[i]);
  }
  if(judge()) cout<<"NO"<<endl;
return 0;
}


#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e5+100;
typedef long long LL;
const LL inf=92233720368547758;
LL l[maxn],r[maxn],p[maxn],n,m;
struct SeamentTree{
	LL l,r,add,val;
}tree[maxn*4];
void pushup(LL p)
{
	tree[p].val=tree[p*2].val&tree[p*2+1].val;
}
void spread(LL p)
{
	if(tree[p].add)
	{
	   tree[p*2].val|=tree[p].add;
	   tree[p*2+1].val|=tree[p].add;
	   tree[p*2].add|=tree[p].add;
	   tree[p*2+1].add|=tree[p].add;
	   tree[p].add=0;
	}
}
void build(LL p,LL l,LL r)
{
	tree[p].l=l;tree[p].r=r;
	if(l==r){tree[p].val=0;return;}
	LL mid=(l+r)/2;
	build(p*2,l,mid);
	build(p*2+1,mid+1,r);
	pushup(p);
}
void change(LL p,LL l,LL r,LL d)
{
	if(l<=tree[p].l&&r>=tree[p].r)
	{
		tree[p].val|=d;
		tree[p].add|=d;
		return;
	}
	spread(p);
	LL mid=(tree[p].l+tree[p].r)/2;
	if(l<=mid) change(p*2,l,r,d);
	if(r>mid) change(p*2+1,l,r,d);
	pushup(p);
}
LL query(LL p,LL l,LL r)
{
	if(l<=tree[p].l&&r>=tree[p].r) return tree[p].val;
	spread(p);
	LL mid=(tree[p].l+tree[p].r)/2;
	LL res=inf;
	if(l<=mid) res &= query(p*2,l,r);
	if(r>mid) res &= query(p*2+1,l,r);
	return res;
}
bool judge()
{
	cout<<endl;
	for(LL i=1;i<=m;i++)
	{
		if(query(1,l[i],r[i])!=p[i]) return true;
	}
	cout<<"YES"<<endl;
	for(LL i=1;i<n;i++){
		cout<<query(1,i,i)<<" ";
	}
	cout<<query(1,n,n)<<endl;
	return false;
}
int main(void)
{
  cin.tie(0);std::ios::sync_with_stdio(false);
  cin>>n>>m;
  build(1,1,n);
  for(LL i=1;i<=m;i++)
  {
	 cin>>l[i]>>r[i]>>p[i];
	 change(1,l[i],r[i],p[i]);
  }
  if(judge()) cout<<"NO"<<endl;
return 0;
}


#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e5+100;
typedef long long LL;
LL l[maxn],r[maxn],p[maxn],n,m;
struct SeamentTree{
	LL l,r,add,val;
}tree[maxn*4];
void pushup(LL p)
{
	tree[p].val=tree[p*2].val&tree[p*2+1].val;
}
void spread(LL p)
{
	if(tree[p].add)
	{
	   tree[p*2].val|=tree[p].val;
	   tree[p*2+1].val|=tree[p].val;
	   tree[p*2].add|=tree[p].add;
	   tree[p*2+1].add|=tree[p].add;
	   tree[p].add=0;
	}
}
void build(LL p,LL l,LL r)
{
	tree[p].l=l;tree[p].r=r;
	if(l==r){tree[p].val=0;return;}
	LL mid=(l+r)/2;
	build(p*2,l,mid);
	build(p*2+1,mid+1,r);
	pushup(p);
}
void change(LL p,LL l,LL r,LL d)
{
	if(l<=tree[p].l&&r>=tree[p].r)
	{
		tree[p].val|=d;
		tree[p].add|=d;
		return;
	}
	spread(p);
	LL mid=(tree[p].l+tree[p].r)/2;
	if(l<=mid) change(p*2,l,mid,d);
	if(r>mid) change(p*2+1,mid+1,r,d);
	pushup(p);
}
LL query(LL p,LL l,LL r)
{
	if(l<=tree[p].l&&r>=tree[p].r) return tree[p].val;
	spread(p);
	LL mid=(tree[p].l+tree[p].r)/2;
	LL res=0x3f3f3f3f3f;
	if(l<=mid) res&=query(p*2,l,r);
	if(r>mid) res&=query(p*2+1,l,r);
	return res;
}
bool judge()
{
//	for(LL i=1;i<=n;i++){
//		cout<<query(1,i,i)<<" ";
//	}
	for(LL i=1;i<=m;i++)
	{
	//	cout<<query(1,l[i],r[i])<<endl;
		if(query(1,l[i],r[i])!=p[i]) return true;
	}
	cout<<"YES"<<endl;
	for(LL i=1;i<n;i++){
		cout<<query(1,i,i)<<" ";
	}
	cout<<query(1,n,n)<<endl;
	return false;
}
int main(void)
{
  cin.tie(0);std::ios::sync_with_stdio(false);
  cin>>n>>m;
  build(1,1,n);
  for(LL i=1;i<=m;i++)
  {
	 cin>>l[i]>>r[i]>>p[i];
	 change(1,l[i],r[i],p[i]);
  }
  if(judge()) cout<<"NO"<<endl;
return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;
int bit[100005][35];
int vals[100005];
int segtree[300005];
pair<pii,int>x[100005];
void update(int idx,int v,int p){
	for(;idx<=100000;idx+=(idx&-idx)){
		bit[idx][p]+=v;
	}
}
int query(int idx,int p){
	int ans=0;
	for(;idx>0;idx-=(idx&-idx)){
		ans+=bit[idx][p];
	}
	return ans;
}
void build(int pos,int l,int r){
	if(l==r){
		segtree[pos]=vals[l];
		return;
	}
	int mid=l+(r-l)/2;
	build(pos*2+1,l,mid);
	build(pos*2+2,mid+1,r);
	segtree[pos]=(segtree[pos*2+1]&segtree[pos*2+2]);
}
int segquery(int pos,int l,int r,int a,int b){
	if(a<=l && b>=r)return segtree[pos];
	if(a>r && b<l)return INT_MAX;
	int mid=l+(r-l)/2;
	return (segquery(pos*2+1,l,mid,a,b)&segquery(pos*2+2,mid+1,r,a,b));
}
void solve(){
	int n,m;
	cin>>n>>m;
	rep(i,0,m){
		cin>>x[i].F.F>>x[i].F.S>>x[i].S;
		rep(j,0,31){
			if(x[i].S&(1<<j)){
				update(x[i].F.F,1,j);
				update(x[i].F.S+1,-1,j);
			}
		}
	}
	rep(i,1,n+1){
		rep(j,0,31){
			if(query(i,j))vals[i-1]|=(1<<j);
		}
	}
	rep(i,0,n){
		if(vals[i]>1e9){
			cout<<"NO";
			return;
		}
	}
	build(0,0,n-1);
	rep(i,0,m){
		if(segquery(0,0,n-1,x[i].F.F-1,x[i].F.S-1)!=x[i].S){
			cout<<"NO";
			return;
		}
	}
	cout<<"YES\n";
	rep(i,0,n)cout<<vals[i]<<" ";
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;
int bit[100005][35];
int vals[100005];
int segtree[300005];
pair<pii,int>x[100005];
void update(int idx,int v,int p){
	for(;idx<=100000;idx+=(idx&-idx)){
		bit[idx][p]+=v;
	}
}
int query(int idx,int p){
	int ans=0;
	for(;idx>0;idx-=(idx&-idx)){
		ans+=bit[idx][p];
	}
	return ans;
}
void build(int pos,int l,int r){
	if(l==r){
		segtree[pos]=vals[l];
		return;
	}
	int mid=l+(r-l)/2;
	build(pos*2+1,l,mid);
	build(pos*2+2,mid+1,r);
	segtree[pos]=(segtree[pos*2+1]&segtree[pos*2+2]);
}
int segquery(int pos,int l,int r,int a,int b){
	if(a<=l && b>=r)return segtree[pos];
	if(a>r && b<l)return INT_MAX;
	int mid=l+(r-l)/2;
	return (segquery(pos*2+1,l,mid,a,b)&segquery(pos*2+2,mid+1,r,a,b));
}
void solve(){
	int n,m;
	cin>>n>>m;
	rep(i,0,m){
		cin>>x[i].F.F>>x[i].F.S>>x[i].S;
		rep(j,0,31){
			if(x[i].S&(1<<j)){
				update(x[i].F.F,1,j);
				update(x[i].F.S+1,-1,j);
			}
		}
	}
	rep(i,1,n+1){
		rep(j,0,31){
			if(query(i,j))vals[i-1]|=(1<<j);
		}
	}
	rep(i,0,n){
		if(vals[i]>=(1<<30)){
			cout<<"NO";
			return;
		}
	}
	build(0,0,n-1);
	rep(i,0,m){
		if(segquery(0,0,n-1,x[i].F.F-1,x[i].F.S-1)!=x[i].S){
			cout<<"NO";
			return;
		}
	}
	cout<<"YES\n";
	rep(i,0,n)cout<<vals[i]<<" ";
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;
int bit[100005][35];
int vals[100005];
int segtree[300005];
pair<pii,int>x[100005];
void update(int idx,int v,int p){
	for(;idx<=100000;idx+=(idx&-idx)){
		bit[idx][p]+=v;
	}
}
int query(int idx,int p){
	int ans=0;
	for(;idx>0;idx-=(idx&-idx)){
		ans+=bit[idx][p];
	}
	return ans;
}
void build(int pos,int l,int r){
	if(l==r){
		segtree[pos]=vals[l];
		return;
	}
	int mid=l+(r-l)/2;
	build(pos*2+1,l,mid);
	build(pos*2+2,mid+1,r);
	segtree[pos]=(segtree[pos*2+1]&segtree[pos*2+2]);
}
int segquery(int pos,int l,int r,int a,int b){
	if(a<=l && b>=r)return segtree[pos];
	if(a>r || b<l)return INT_MAX;
	int mid=l+(r-l)/2;
	return (segquery(pos*2+1,l,mid,a,b)&segquery(pos*2+2,mid+1,r,a,b));
}
void solve(){
	int n,m;
	cin>>n>>m;
	rep(i,0,m){
		cin>>x[i].F.F>>x[i].F.S>>x[i].S;
		rep(j,0,31){
			if(x[i].S&(1<<j)){
				update(x[i].F.F,1,j);
				update(x[i].F.S+1,-1,j);
			}
		}
	}
	rep(i,1,n+1){
		rep(j,0,31){
			if(query(i,j))vals[i-1]|=(1<<j);
		}
	}
	build(0,0,n-1);
	rep(i,0,m){
		if(segquery(0,0,n-1,x[i].F.F-1,x[i].F.S-1)!=x[i].S){
			cout<<"NO";
			return;
		}
	}
	cout<<"YES\n";
	rep(i,0,n)cout<<vals[i]<<" ";
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#define int 		long long
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;
int bit[100005][35];
int vals[100005];
int segtree[300005];
pair<pii,int>x[100005];
void update(int idx,int v,int p){
	for(;idx<=100000;idx+=(idx&-idx)){
		bit[idx][p]+=v;
	}
}
int query(int idx,int p){
	int ans=0;
	for(;idx>0;idx-=(idx&-idx)){
		ans+=bit[idx][p];
	}
	return ans;
}
void build(int pos,int l,int r){
	cerr<<pos<<" "<<l<<" "<<r<<endl;
	if(l==r){
		segtree[pos]=vals[l];
		return;
	}
	int mid=l+(r-l)/2;
	build(pos*2+1,l,mid);
	build(pos*2+2,mid+1,r);
	segtree[pos]=(segtree[pos*2+1]&segtree[pos*2+2]);
}
int segquery(int pos,int l,int r,int a,int b){
	if(a<=l && b>=r)return segtree[pos];
	if(a>r || b<l)return INT_MAX;
	int mid=l+(r-l)/2;
	return (segquery(pos*2+1,l,mid,a,b)&segquery(pos*2+2,mid+1,r,a,b));
}
void solve(){
	int n,m;
	cin>>n>>m;
	rep(i,0,m){
		cin>>x[i].F.F>>x[i].F.S>>x[i].S;
		rep(j,0,31){
			if(x[i].S&(1LL<<j)){
				update(x[i].F.F,1,j);
				update(x[i].F.S+1,-1,j);
			}
		}
	}
	rep(i,1,n+1){
		rep(j,0,31){
			if(query(i,j))vals[i-1]|=(1LL<<j);
		}
	}
	build(0,0,n-1);
	rep(i,0,10)cerr<<i<<" "<<segtree[i]<<endl;
	rep(i,0,m){
		if(segquery(0,0,n-1,x[i].F.F-1,x[i].F.S-1)!=x[i].S){
			cout<<"NO";
			return;
		}
	}
	cout<<"YES\n";
	rep(i,0,n)cout<<vals[i]<<" ";
}
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;
int bit[100005][34];
int vals[100005];
int segtree[300005];
pair<pii,int>x[100005];
void update(int idx,int v,int p){
	for(;idx<=100000;idx+=(idx&-idx)){
		bit[idx][p]+=v;
	}
}
int query(int idx,int p){
	int ans=0;
	for(;idx>0;idx-=(idx&-idx)){
		ans+=bit[idx][p];
	}
	return ans;
}
void build(int pos,int l,int r){
	if(l==r){
		segtree[pos]=vals[l];
		return;
	}
	int mid=l+(r-l)/2;
	build(pos*2+1,l,mid);
	build(pos*2+2,mid+1,r);
	segtree[pos]=(segtree[pos*2+1]&segtree[pos*2+2]);
}
int segquery(int pos,int l,int r,int a,int b){
	if(a<=l && b>=r)return segtree[pos];
	if(a>r && b<l)return INT_MAX;
	int mid=l+(r-l)/2;
	return (segquery(pos*2+1,l,mid,a,b)&segquery(pos*2+2,mid+1,r,a,b));
}
void solve(){
	int n,m;
	cin>>n>>m;
	rep(i,0,m){
		cin>>x[i].F.F>>x[i].F.S>>x[i].S;
		rep(j,0,31){
			if(x[i].S&(1<<j)){
				update(x[i].F.F,1,j);
				update(x[i].F.S+1,-1,j);
			}
		}
	}
	rep(i,1,n+1){
		rep(j,0,31){
			if(query(i,j))vals[i-1]|=(1<<j);
		}
	}
	build(0,0,n-1);
	rep(i,0,m){
		if(segquery(0,0,n-1,x[i].F.F-1,x[i].F.S-1)!=x[i].S){
			cout<<"NO";
			return;
		}
	}
	cout<<"YES\n";
	rep(i,0,n)cout<<vals[i]<<" ";
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;
int bit[100001][31];
int vals[100001];
int segtree[300005];
pair<pii,int>x[100005];
void update(int idx,int v,int p){
	for(;idx<=100000;idx+=(idx&-idx)){
		bit[idx][p]+=v;
	}
}
int query(int idx,int p){
	int ans=0;
	for(;idx>0;idx-=(idx&-idx)){
		ans+=bit[idx][p];
	}
	return ans;
}
void build(int pos,int l,int r){
	if(l==r){
		segtree[pos]=vals[l];
		return;
	}
	int mid=l+(r-l)/2;
	build(pos*2+1,l,mid);
	build(pos*2+2,mid+1,r);
	segtree[pos]=(segtree[pos*2+1]&segtree[pos*2+2]);
}
int segquery(int pos,int l,int r,int a,int b){
	if(a<=l && b>=r)return segtree[pos];
	if(a>r && b<l)return INT_MAX;
	int mid=l+(r-l)/2;
	return segquery(pos*2+1,l,mid,a,b)&segquery(pos*2+2,mid+1,r,a,b);
}
void solve(){
	int n,m;
	cin>>n>>m;
	rep(i,0,m){
		cin>>x[i].F.F>>x[i].F.S>>x[i].S;
		rep(j,0,31){
			if(x[i].S&(1<<j)){
				update(x[i].F.F,1,j);
				update(x[i].F.S+1,-1,j);
			}
		}
	}
	rep(i,1,n+1){
		rep(j,0,31){
			if(query(i,j))vals[i-1]|=(1<<j);
		}
	}
	build(0,0,n-1);
	rep(i,0,m){
		if(segquery(0,0,n-1,x[i].F.F-1,x[i].F.S-1)!=x[i].S){
			cout<<"NO";
			return;
		}
	}
	cout<<"YES\n";
	rep(i,0,n)cout<<vals[i]<<" ";
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#define double 		long double
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;
int bit[100001][31];
int vals[100001];
int segtree[400005];
void update(int idx,int v,int p){
	for(;idx<=100000;idx+=(idx&-idx)){
		bit[idx][p]+=v;
	}
}
int query(int idx,int p){
	int ans=0;
	for(;idx>0;idx-=(idx&-idx)){
		ans+=bit[idx][p];
	}
	return ans;
}
void build(int pos,int l,int r){
	if(l==r){
		segtree[pos]=vals[l];
		return;
	}
	int mid=l+(r-l)/2;
	build(pos*2+1,l,mid);
	build(pos*2+2,mid+1,r);
	segtree[pos]=(segtree[pos*2+1]&segtree[pos*2+2]);
}
int segquery(int pos,int l,int r,int a,int b){
	if(a<=l && b>=r)return segtree[pos];
	if(a>r && b<l)return INT_MAX;
	int mid=l+(r-l)/2;
	return segquery(pos*2+1,l,mid,a,b)&segquery(pos*2+2,mid+1,r,a,b);
}
void solve(){
	int n,m;
	cin>>n>>m;
	vector<pair<pii,int>>x(m);
	rep(i,0,m){
		cin>>x[i].F.F>>x[i].F.S>>x[i].S;
		rep(j,0,31){
			if(x[i].S&(1<<j)){
				update(x[i].F.F,1,j);
				update(x[i].F.S+1,-1,j);
			}
		}
	}
	rep(i,1,n+1){
		rep(j,0,31){
			if(query(i,j))vals[i-1]|=(1<<j);
		}
	}
	build(0,0,n-1);
	rep(i,0,m){
		if(segquery(0,0,n-1,x[i].F.F-1,x[i].F.S-1)!=x[i].S){
			cout<<"NO";
			return;
		}
	}
	cout<<"YES\n";
	rep(i,0,n)cout<<vals[i]<<" ";
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;
int bit[100005][35];
int vals[100005];
int segtree[300005];
pair<pii,int>x[100005];
void update(int idx,int v,int p){
	for(;idx<=100000;idx+=(idx&-idx)){
		bit[idx][p]+=v;
	}
}
int query(int idx,int p){
	int ans=0;
	for(;idx>0;idx-=(idx&-idx)){
		ans+=bit[idx][p];
	}
	return ans;
}
void build(int pos,int l,int r){
	if(l==r){
		segtree[pos]=vals[l];
		return;
	}
	int mid=l+(r-l)/2;
	build(pos*2+1,l,mid);
	build(pos*2+2,mid+1,r);
	segtree[pos]=(segtree[pos*2+1]&segtree[pos*2+2]);
}
int segquery(int pos,int l,int r,int a,int b){
	if(a<=l && b>=r)return segtree[pos];
	if(a>r && b<l)return INT_MAX;
	int mid=l+(r-l)/2;
	return (segquery(pos*2+1,l,mid,a,b)&segquery(pos*2+2,mid+1,r,a,b));
}
void solve(){
	int n,m;
	cin>>n>>m;
	rep(i,0,m){
		cin>>x[i].F.F>>x[i].F.S>>x[i].S;
		rep(j,0,31){
			if(x[i].S&(1<<j)){
				update(x[i].F.F,1,j);
				update(x[i].F.S+1,-1,j);
			}
		}
	}
	rep(i,1,n+1){
		rep(j,0,31){
			if(query(i,j))vals[i-1]|=(1<<j);
		}
	}
	build(0,0,n-1);
	rep(i,0,m){
		if(segquery(0,0,n-1,x[i].F.F-1,x[i].F.S-1)!=x[i].S){
			cout<<"NO";
			return;
		}
	}
	cout<<"YES\n";
	rep(i,0,n)cout<<vals[i]<<" ";
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)	for(int i=a;i<b;i++)
using namespace std;
int bit[100001][31];
int vals[100001];
int segtree[400005];
pair<pii,int>x[100005];
void update(int idx,int v,int p){
	for(;idx<=100000;idx+=(idx&-idx)){
		bit[idx][p]+=v;
	}
}
int query(int idx,int p){
	int ans=0;
	for(;idx>0;idx-=(idx&-idx)){
		ans+=bit[idx][p];
	}
	return ans;
}
void build(int pos,int l,int r){
	if(l==r){
		segtree[pos]=vals[l];
		return;
	}
	int mid=l+(r-l)/2;
	build(pos*2+1,l,mid);
	build(pos*2+2,mid+1,r);
	segtree[pos]=(segtree[pos*2+1]&segtree[pos*2+2]);
}
int segquery(int pos,int l,int r,int a,int b){
	if(a<=l && b>=r)return segtree[pos];
	if(a>r && b<l)return INT_MAX;
	int mid=l+(r-l)/2;
	return segquery(pos*2+1,l,mid,a,b)&segquery(pos*2+2,mid+1,r,a,b);
}
void solve(){
	int n,m;
	cin>>n>>m;

	rep(i,0,m){
		cin>>x[i].F.F>>x[i].F.S>>x[i].S;
		rep(j,0,31){
			if(x[i].S&(1<<j)){
				update(x[i].F.F,1,j);
				update(x[i].F.S+1,-1,j);
			}
		}
	}
	rep(i,1,n+1){
		rep(j,0,31){
			if(query(i,j))vals[i-1]|=(1<<j);
		}
	}
	build(0,0,n-1);
	rep(i,0,m){
		if(segquery(0,0,n-1,x[i].F.F-1,x[i].F.S-1)!=x[i].S){
			cout<<"NO";
			return;
		}
	}
	cout<<"YES\n";
	rep(i,0,n)cout<<vals[i]<<" ";
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t=1;
//	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
#define MAXLOG 31

struct query
{
		int l , r , q;
} a[MAXN];

int n , m;
int value[MAXN],cnt[MAXN];

struct SegmentTree
{
		struct Node
		{
				int l , r , val;
		} Tree[MAXN << 2];
		inline void build(int index,int l,int r)
		{
				Tree[index].l = l;
				Tree[index].r = r;
				if (l == r)
				{
						Tree[index].val = value[l];
						return;
				}
				int mid = (l + r) >> 1;
				build(index << 1,l,mid);
				build(index << 1 | 1,mid + 1,r);
				update(index);
		}
		inline void update(int index)
		{
				Tree[index].val = Tree[index << 1].val & Tree[index << 1 | 1].val;
		}
		inline int query(int index,int l,int r)
		{
				if (Tree[index].l == l && Tree[index].r == r) return Tree[index].val;
				int mid = (Tree[index].l + Tree[index].r) >> 1;
				if (mid >= r) return query(index << 1,l,r);
				else if (mid + 1 <= l) return query(index << 1 | 1,l,r);
				else return query(index << 1,l,mid) & query(index << 1 | 1,mid + 1,r);
		}
} T;

template <typename T> inline void chkmax(T &x,T y) { x = max(x,y); }
template <typename T> inline void chkmin(T &x,T y) { x = min(x,y); }
template <typename T> inline void read(T &x)
{
    T f = 1; x = 0;
    char c = getchar();
    for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
    for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
    x *= f;
}

int main()
{

		read(n); read(m);
		for (int i = 1; i <= m; i++)
		{
				read(a[i].l);
				read(a[i].r);
				read(a[i].q);
		}
		for (int i = 0; i < MAXLOG; i++)
		{
				for (int j = 1; j <= n; j++) cnt[j] = 0;
				for (int j = 1; j <= n; j++)
				{
						if (a[j].q & (1 << i))
						{
								cnt[a[j].l]++;
								cnt[a[j].r + 1]--;
						}
				}
				for (int j = 1; j <= n; j++)
				{
						cnt[j] += cnt[j - 1];
						if (cnt[j] > 0)
								value[j] |= (1 << i);
				}
		}
		T.build(1,1,n);
		for (int i = 1; i <= m; i++)
		{
				if (T.query(1,a[i].l,a[i].r) != a[i].q)
				{
						printf("NO\n");
						return 0;
				}
		}
		printf("YES\n");
		for (int i = 1; i <= n; i++) printf("%d ",value[i]);
		printf("\n");

		return 0;

}


#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O2")
const int MAXN = 1e5 + 10;
#define MAXLOG 31

struct query
{
		int l , r , q;
} a[MAXN];

int n , m;

struct SegmentTree
{
		struct Node
		{
				int l , r;
				int cnt;
				bool tag;
		} Tree[MAXN << 2];
		inline void build(int index,int l,int r)
		{
				Tree[index].l = l;
				Tree[index].r = r;
				Tree[index].cnt = 0;
				Tree[index].tag = false;
				if (l == r) return;
				int mid = (l + r) >> 1;
				build(index << 1,l,mid);
				build(index << 1 | 1,mid + 1,r);
		}
		inline void pushdown(int index)
		{
				if (Tree[index].tag)
				{
						int l = Tree[index].l , r = Tree[index].r;
						int mid = (l + r) >> 1;
 						Tree[index << 1].cnt = mid - l + 1;
 						Tree[index << 1 | 1].cnt = r - mid;
 						Tree[index << 1].tag = Tree[index << 1 | 1].tag = true;
 						Tree[index].tag = false;
				}
		}
		inline void update(int index)
		{
				Tree[index].cnt = Tree[index << 1].cnt + Tree[index << 1 | 1].cnt;
		}
		inline void modify(int index,int l,int r)
		{
				if (Tree[index].l == l && Tree[index].r == r)
				{
						Tree[index].cnt = r - l + 1;
						Tree[index].tag = true;
						return;
				}
				pushdown(index);
				int mid = (Tree[index].l + Tree[index].r) >> 1;
				if (mid >= r) modify(index << 1,l,r);
				else if (mid + 1 <= l) modify(index << 1 | 1,l,r);
				else
				{
						modify(index << 1,l,mid);
						modify(index << 1 | 1,mid + 1,r);
				}
				update(index);
		}
		inline int query(int index,int l,int r)
		{
				if (Tree[index].l == l && Tree[index].r == r) return Tree[index].cnt;
				pushdown(index);
				int mid = (Tree[index].l + Tree[index].r) >> 1;
				if (mid >= r) return query(index << 1,l,r);
				else if (mid + 1 <= l) return query(index << 1 | 1,l,r);
				else return query(index << 1,l,mid) + query(index << 1 | 1,mid + 1,r);
		}
} T[MAXLOG];

template <typename T> inline void chkmax(T &x,T y) { x = max(x,y); }
template <typename T> inline void chkmin(T &x,T y) { x = min(x,y); }
template <typename T> inline void read(T &x)
{
    T f = 1; x = 0;
    char c = getchar();
    for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
    for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
    x *= f;
}

int main()
{

		read(n); read(m);
		for (int i = 0; i < MAXLOG; i++) T[i].build(1,1,n);
		for (int i = 1; i <= m; i++)
		{
				read(a[i].l);
				read(a[i].r);
				read(a[i].q);
		}
		for (int i = 1; i <= m; i++)
		{
				for (int j = 0; j < MAXLOG; j++)
				{
						if (a[i].q & (1 << j))
						 		T[j].modify(1,a[i].l,a[i].r);
				}
		}
		for (int i = 1; i <= m; i++)
		{
				for (int j = 0; j < MAXLOG; j++)
				{
						if (a[i].q < (1 << j)) break;
						if (a[i].q & (1 << j)) continue;
						if (T[j].query(1,a[i].l,a[i].r) == a[i].r - a[i].l + 1)
						{
								printf("NO\n");
								return 0;
						}
				}
		}
		printf("YES\n");
		for (int i = 1; i <= n; i++)
		{
				int res = 0;
				for (int j = 0; j < MAXLOG; j++)
				{
						if (T[j].query(1,i,i))
								res += 1 << j;
				}
				printf("%d ",res);
		}
		printf("\n");

		return 0;

}


#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
#define MAXLOG 31

struct query
{
		int l , r , q;
} a[MAXN];

int n , m;
int value[MAXN],cnt[MAXN];

struct SegmentTree
{
		struct Node
		{
				int l , r , val;
		} Tree[MAXN << 2];
		inline void build(int index,int l,int r)
		{
				Tree[index].l = l;
				Tree[index].r = r;
				if (l == r)
				{
						Tree[index].val = value[l];
						return;
				}
				int mid = (l + r) >> 1;
				build(index << 1,l,mid);
				build(index << 1 | 1,mid + 1,r);
				update(index);
		}
		inline void update(int index)
		{
				Tree[index].val = Tree[index << 1].val & Tree[index << 1 | 1].val;
		}
		inline int query(int index,int l,int r)
		{
				if (Tree[index].l == l && Tree[index].r == r) return Tree[index].val;
				int mid = (Tree[index].l + Tree[index].r) >> 1;
				if (mid >= r) return query(index << 1,l,r);
				else if (mid + 1 <= l) return query(index << 1 | 1,l,r);
				else return query(index << 1,l,mid) & query(index << 1 | 1,mid + 1,r);
		}
} T;

template <typename T> inline void chkmax(T &x,T y) { x = max(x,y); }
template <typename T> inline void chkmin(T &x,T y) { x = min(x,y); }
template <typename T> inline void read(T &x)
{
    T f = 1; x = 0;
    char c = getchar();
    for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
    for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
    x *= f;
}

int main()
{

		read(n); read(m);
		for (int i = 1; i <= m; i++)
		{
				read(a[i].l);
				read(a[i].r);
				read(a[i].q);
		}
		for (int i = 0; i < MAXLOG; i++)
		{
				for (int j = 0; j <= n; j++) cnt[j] = 0;
				for (int j = 1; j <= m; j++)
				{
						if (a[j].q & (1 << i))
						{
								cnt[a[j].l]++;
								cnt[a[j].r + 1]--;
						}
				}
				for (int j = 1; j <= n; j++)
				{
						cnt[j] += cnt[j - 1];
						if (cnt[j] > 0)
								value[j] |= (1 << i);
				}
		}
		T.build(1,1,n);
		for (int i = 1; i <= m; i++)
		{
				if (T.query(1,a[i].l,a[i].r) != a[i].q)
				{
						printf("NO\n");
						return 0;
				}
		}
		printf("YES\n");
		for (int i = 1; i <= n; i++) printf("%d ",value[i]);
		printf("\n");

		return 0;

}


#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
#define MAXLOG 31

struct query
{
		int l , r , q;
} a[MAXN];

int n , m;
int value[MAXN];

struct SegmentTree
{
		struct Node
		{
				int l , r;
				int cnt;
				bool tag;
		} Tree[MAXN << 2];
		inline void build(int index,int l,int r)
		{
				Tree[index].l = l;
				Tree[index].r = r;
				Tree[index].cnt = 0;
				Tree[index].tag = false;
				if (l == r) return;
				int mid = (l + r) >> 1;
				build(index << 1,l,mid);
				build(index << 1 | 1,mid + 1,r);
		}
		inline void pushdown(int index)
		{
				if (Tree[index].tag)
				{
						int l = Tree[index].l , r = Tree[index].r;
						int mid = (l + r) >> 1;
 						Tree[index << 1].cnt = mid - l + 1;
 						Tree[index << 1 | 1].cnt = r - mid;
 						Tree[index << 1].tag = Tree[index << 1 | 1].tag = true;
 						Tree[index].tag = false;
				}
		}
		inline void update(int index)
		{
				Tree[index].cnt = Tree[index << 1].cnt + Tree[index << 1 | 1].cnt;
		}
		inline void modify(int index,int l,int r)
		{
				if (Tree[index].l == l && Tree[index].r == r)
				{
						Tree[index].cnt = r - l + 1;
						Tree[index].tag = true;
						return;
				}
				pushdown(index);
				int mid = (Tree[index].l + Tree[index].r) >> 1;
				if (mid >= r) modify(index << 1,l,r);
				else if (mid + 1 <= l) modify(index << 1 | 1,l,r);
				else
				{
						modify(index << 1,l,mid);
						modify(index << 1 | 1,mid + 1,r);
				}
				update(index);
		}
		inline int query(int index,int l,int r)
		{
				if (Tree[index].l == l && Tree[index].r == r) return Tree[index].cnt;
				pushdown(index);
				int mid = (Tree[index].l + Tree[index].r) >> 1;
				if (mid >= r) return query(index << 1,l,r);
				else if (mid + 1 <= l) return query(index << 1 | 1,l,r);
				else return query(index << 1,l,mid) + query(index << 1 | 1,mid + 1,r);
		}
		inline void calc(int index,int val)
		{
				if (Tree[index].l == Tree[index].r)
				{
						if (Tree[index].cnt) value[Tree[index].l] += val;
						return;
				}
				pushdown(index);
				calc(index << 1,val);
				calc(index << 1 | 1,val);
		}
} T[MAXLOG];

template <typename T> inline void chkmax(T &x,T y) { x = max(x,y); }
template <typename T> inline void chkmin(T &x,T y) { x = min(x,y); }
template <typename T> inline void read(T &x)
{
    T f = 1; x = 0;
    char c = getchar();
    for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
    for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
    x *= f;
}

int main()
{

		read(n); read(m);
		for (int i = 0; i < MAXLOG; i++) T[i].build(1,1,n);
		for (int i = 1; i <= m; i++)
		{
				read(a[i].l);
				read(a[i].r);
				read(a[i].q);
		}
		for (int i = 1; i <= m; i++)
		{
				for (int j = 0; j < MAXLOG; j++)
				{
						if (a[i].q < (1 << j)) break;
						if (a[i].q & (1 << j))
						 		T[j].modify(1,a[i].l,a[i].r);
				}
		}
		for (int i = 1; i <= m; i++)
		{
				for (int j = 0; j < MAXLOG; j++)
				{
						if (a[i].q & (1 << j)) continue;
						if (T[j].query(1,a[i].l,a[i].r) == a[i].r - a[i].l + 1)
						{
								printf("NO\n");
								return 0;
						}
				}
		}
		printf("YES\n");
		for (int i = 0; i < MAXLOG; i++) T[i].calc(1,1 << i);
		for (int i = 1; i <= n; i++) printf("%d ",value[i]);
		printf("\n");

		return 0;

}


#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
#define MAXLOG 31

struct query
{
		int l , r , q;
} a[MAXN];

int n , m;

struct SegmentTree
{
		struct Node
		{
				int l , r;
				int cnt;
				bool tag;
		} Tree[MAXN << 2];
		inline void build(int index,int l,int r)
		{
				Tree[index].l = l;
				Tree[index].r = r;
				Tree[index].cnt = 0;
				Tree[index].tag = false;
				if (l == r) return;
				int mid = (l + r) >> 1;
				build(index << 1,l,mid);
				build(index << 1 | 1,mid + 1,r);
		}
		inline void pushdown(int index)
		{
				if (Tree[index].tag)
				{
						int l = Tree[index].l , r = Tree[index].r;
						int mid = (l + r) >> 1;
 						Tree[index << 1].cnt = mid - l + 1;
 						Tree[index << 1 | 1].cnt = r - mid;
 						Tree[index << 1].tag = Tree[index << 1 | 1].tag = true;
 						Tree[index].tag = false;
				}
		}
		inline void update(int index)
		{
				Tree[index].cnt = Tree[index << 1].cnt + Tree[index << 1 | 1].cnt;
		}
		inline void modify(int index,int l,int r)
		{
				if (Tree[index].l == l && Tree[index].r == r)
				{
						Tree[index].cnt = r - l + 1;
						Tree[index].tag = true;
						return;
				}
				pushdown(index);
				int mid = (Tree[index].l + Tree[index].r) >> 1;
				if (mid >= r) modify(index << 1,l,r);
				else if (mid + 1 <= l) modify(index << 1 | 1,l,r);
				else
				{
						modify(index << 1,l,mid);
						modify(index << 1 | 1,mid + 1,r);
				}
				update(index);
		}
		inline int query(int index,int l,int r)
		{
				if (Tree[index].l == l && Tree[index].r == r) return Tree[index].cnt;
				pushdown(index);
				int mid = (Tree[index].l + Tree[index].r) >> 1;
				if (mid >= r) return query(index << 1,l,r);
				else if (mid + 1 <= l) return query(index << 1 | 1,l,r);
				else return query(index << 1,l,mid) + query(index << 1 | 1,mid + 1,r);
		}
} T[MAXLOG];

template <typename T> inline void chkmax(T &x,T y) { x = max(x,y); }
template <typename T> inline void chkmin(T &x,T y) { x = min(x,y); }
template <typename T> inline void read(T &x)
{
    T f = 1; x = 0;
    char c = getchar();
    for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
    for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
    x *= f;
}

int main()
{

		read(n); read(m);
		for (int i = 0; i < MAXLOG; i++) T[i].build(1,1,n);
		for (int i = 1; i <= m; i++)
		{
				read(a[i].l);
				read(a[i].r);
				read(a[i].q);
		}
		for (int i = 1; i <= m; i++)
		{
				for (int j = 0; j < MAXLOG; j++)
				{
						if (a[i].q & (1 << j))
						 		T[j].modify(1,a[i].l,a[i].r);
				}
		}
		for (int i = 1; i <= m; i++)
		{
				for (int j = 0; j < MAXLOG; j++)
				{
						if (a[i].q < (1 << j)) break;
						if (a[i].q & (1 << j)) continue;
						if (T[j].query(1,a[i].l,a[i].r) == a[i].r - a[i].l + 1)
						{
								printf("NO\n");
								return 0;
						}
				}
		}
		printf("YES\n");
		for (int i = 1; i <= n; i++)
		{
				int res = 0;
				for (int j = 0; j < MAXLOG; j++)
				{
						if (T[j].query(1,i,i))
								res += 1 << j;
				}
				printf("%d ",res);
		}
		printf("\n");

		return 0;

}


#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
#define MAXLOG 31

struct query
{
		int l , r , q;
} a[MAXN];

int n , m;

struct SegmentTree
{
		struct Node
		{
				int l , r;
				int cnt;
				bool tag;
		} Tree[MAXN << 2];
		inline void build(int index,int l,int r)
		{
				Tree[index].l = l;
				Tree[index].r = r;
				Tree[index].cnt = 0;
				Tree[index].tag = false;
				if (l == r) return;
				int mid = (l + r) >> 1;
				build(index << 1,l,mid);
				build(index << 1 | 1,mid + 1,r);
		}
		inline void pushdown(int index)
		{
				if (Tree[index].tag)
				{
						int l = Tree[index].l , r = Tree[index].r;
						int mid = (l + r) >> 1;
 						Tree[index << 1].cnt = mid - l + 1;
 						Tree[index << 1 | 1].cnt = r - mid;
 						Tree[index << 1].tag = Tree[index << 1 | 1].tag = true;
 						Tree[index].tag = false;
				}
		}
		inline void update(int index)
		{
				Tree[index].cnt = Tree[index << 1].cnt + Tree[index << 1 | 1].cnt;
		}
		inline void modify(int index,int l,int r)
		{
				if (Tree[index].l == l && Tree[index].r == r)
				{
						Tree[index].cnt = r - l + 1;
						Tree[index].tag = true;
						return;
				}
				pushdown(index);
				int mid = (Tree[index].l + Tree[index].r) >> 1;
				if (mid >= r) modify(index << 1,l,r);
				else if (mid + 1 <= l) modify(index << 1 | 1,l,r);
				else
				{
						modify(index << 1,l,mid);
						modify(index << 1 | 1,mid + 1,r);
				}
				update(index);
		}
		inline int query(int index,int l,int r)
		{
				if (Tree[index].l == l && Tree[index].r == r) return Tree[index].cnt;
				pushdown(index);
				int mid = (Tree[index].l + Tree[index].r) >> 1;
				if (mid >= r) return query(index << 1,l,r);
				else if (mid + 1 <= l) return query(index << 1 | 1,l,r);
				else return query(index << 1,l,mid) + query(index << 1 | 1,mid + 1,r);
		}
} T[MAXLOG];

template <typename T> inline void chkmax(T &x,T y) { x = max(x,y); }
template <typename T> inline void chkmin(T &x,T y) { x = min(x,y); }
template <typename T> inline void read(T &x)
{
    T f = 1; x = 0;
    char c = getchar();
    for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
    for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
    x *= f;
}

int main()
{

		read(n); read(m);
		for (int i = 0; i < MAXLOG; i++) T[i].build(1,1,n);
		for (int i = 1; i <= m; i++)
		{
				read(a[i].l);
				read(a[i].r);
				read(a[i].q);
		}
		for (int i = 1; i <= m; i++)
		{
				for (int j = 0; j < MAXLOG; j++)
				{
						if (a[i].q < (1 << j)) break;
						if (a[i].q & (1 << j))
						 		T[j].modify(1,a[i].l,a[i].r);
				}
		}
		for (int i = 1; i <= m; i++)
		{
				for (int j = 0; j < MAXLOG; j++)
				{
						if (a[i].q < (1 << j)) break;
						if (a[i].q & (1 << j)) continue;
						if (T[j].query(1,a[i].l,a[i].r) == a[i].r - a[i].l + 1)
						{
								printf("NO\n");
								return 0;
						}
				}
		}
		printf("YES\n");
		for (int i = 1; i <= n; i++)
		{
				int res = 0;
				for (int j = 0; j < MAXLOG; j++)
				{
						if (T[j].query(1,i,i))
								res += 1 << j;
				}
				printf("%d ",res);
		}
		printf("\n");

		return 0;

}


#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O2")
const int MAXN = 1e5 + 10;
#define MAXLOG 31

struct query
{
		int l , r , q;
} a[MAXN];

int n , m;

struct SegmentTree
{
		struct Node
		{
				int l , r;
				int cnt;
				bool tag;
		} Tree[MAXN << 2];
		inline void build(int index,int l,int r)
		{
				Tree[index].l = l;
				Tree[index].r = r;
				Tree[index].cnt = 0;
				Tree[index].tag = false;
				if (l == r) return;
				int mid = (l + r) >> 1;
				build(index << 1,l,mid);
				build(index << 1 | 1,mid + 1,r);
		}
		inline void pushdown(int index)
		{
				if (Tree[index].tag)
				{
						int l = Tree[index].l , r = Tree[index].r;
						int mid = (l + r) >> 1;
 						Tree[index << 1].cnt = mid - l + 1;
 						Tree[index << 1 | 1].cnt = r - mid;
 						Tree[index << 1].tag = Tree[index << 1 | 1].tag = true;
 						Tree[index].tag = false;
				}
		}
		inline void update(int index)
		{
				Tree[index].cnt = Tree[index << 1].cnt + Tree[index << 1 | 1].cnt;
		}
		inline void modify(int index,int l,int r)
		{
				if (Tree[index].l == l && Tree[index].r == r)
				{
						Tree[index].cnt = r - l + 1;
						Tree[index].tag = true;
						return;
				}
				pushdown(index);
				int mid = (Tree[index].l + Tree[index].r) >> 1;
				if (mid >= r) modify(index << 1,l,r);
				else if (mid + 1 <= l) modify(index << 1 | 1,l,r);
				else
				{
						modify(index << 1,l,mid);
						modify(index << 1 | 1,mid + 1,r);
				}
				update(index);
		}
		inline int query(int index,int l,int r)
		{
				if (Tree[index].l == l && Tree[index].r == r) return Tree[index].cnt;
				pushdown(index);
				int mid = (Tree[index].l + Tree[index].r) >> 1;
				if (mid >= r) return query(index << 1,l,r);
				else if (mid + 1 <= l) return query(index << 1 | 1,l,r);
				else return query(index << 1,l,mid) + query(index << 1 | 1,mid + 1,r);
		}
} T[MAXLOG];

template <typename T> inline void chkmax(T &x,T y) { x = max(x,y); }
template <typename T> inline void chkmin(T &x,T y) { x = min(x,y); }
template <typename T> inline void read(T &x)
{
    T f = 1; x = 0;
    char c = getchar();
    for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
    for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
    x *= f;
}

int main()
{

		read(n); read(m);
		for (int i = 0; i < MAXLOG; i++) T[i].build(1,1,n);
		for (int i = 1; i <= m; i++)
		{
				read(a[i].l);
				read(a[i].r);
				read(a[i].q);
		}
		for (int i = 1; i <= m; i++)
		{
				for (int j = 0; j < MAXLOG; j++)
				{
						if (a[i].q & (1 << j))
						 		T[j].modify(1,a[i].l,a[i].r);
				}
		}
		for (int i = 1; i <= m; i++)
		{
				for (int j = 0; j < MAXLOG; j++)
				{
						if (a[i].q < (1 << j)) break;
						if (a[i].q & (1 << j)) continue;
						if (T[j].query(1,a[i].l,a[i].r) == a[i].r - a[i].l + 1)
						{
								printf("NO\n");
								return 0;
						}
				}
		}
		printf("YES\n");
		for (int i = 1; i <= n; i++)
		{
				int res = 0;
				for (int j = 0; j < MAXLOG; j++)
				{
						if (T[j].query(1,i,i))
								res += 1 << j;
				}
				printf("%d ",res);
		}
		printf("\n");

		return 0;

}
v


#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
#define MAXLOG 31

struct query
{
		int l , r , q;
} a[MAXN];

int n , m;

struct SegmentTree
{
		struct Node
		{
				int l , r;
				int cnt;
				bool tag;
		} Tree[MAXN << 2];
		inline void build(int index,int l,int r)
		{
				Tree[index].l = l;
				Tree[index].r = r;
				Tree[index].cnt = 0;
				Tree[index].tag = false;
				if (l == r) return;
				int mid = (l + r) >> 1;
				build(index << 1,l,mid);
				build(index << 1 | 1,mid + 1,r);
		}
		inline void pushdown(int index)
		{
				if (Tree[index].tag)
				{
						int l = Tree[index].l , r = Tree[index].r;
						int mid = (l + r) >> 1;
 						Tree[index << 1].cnt = mid - l + 1;
 						Tree[index << 1 | 1].cnt = r - mid;
 						Tree[index << 1].tag = Tree[index << 1 | 1].tag = true;
 						Tree[index].tag = false;
				}
		}
		inline void update(int index)
		{
				Tree[index].cnt = Tree[index << 1].cnt + Tree[index << 1 | 1].cnt;
		}
		inline void modify(int index,int l,int r)
		{
				if (Tree[index].l == l && Tree[index].r == r)
				{
						Tree[index].cnt = r - l + 1;
						Tree[index].tag = true;
						return;
				}
				pushdown(index);
				int mid = (Tree[index].l + Tree[index].r) >> 1;
				if (mid >= r) modify(index << 1,l,r);
				else if (mid + 1 <= l) modify(index << 1 | 1,l,r);
				else
				{
						modify(index << 1,l,mid);
						modify(index << 1 | 1,mid + 1,r);
				}
				update(index);
		}
		inline int query(int index,int l,int r)
		{
				if (Tree[index].l == l && Tree[index].r == r) return Tree[index].cnt;
				pushdown(index);
				int mid = (Tree[index].l + Tree[index].r) >> 1;
				if (mid >= r) return query(index << 1,l,r);
				else if (mid + 1 <= l) return query(index << 1 | 1,l,r);
				else return query(index << 1,l,mid) + query(index << 1 | 1,mid + 1,r);
		}
} T[MAXLOG];

template <typename T> inline void chkmax(T &x,T y) { x = max(x,y); }
template <typename T> inline void chkmin(T &x,T y) { x = min(x,y); }
template <typename T> inline void read(T &x)
{
    T f = 1; x = 0;
    char c = getchar();
    for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
    for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
    x *= f;
}

int main()
{

		read(n); read(m);
		for (int i = 0; i < MAXLOG; i++) T[i].build(1,1,n);
		for (int i = 1; i <= m; i++)
		{
				read(a[i].l);
				read(a[i].r);
				read(a[i].q);
		}
		for (int i = 1; i <= m; i++)
		{
				for (int j = 0; j < MAXLOG; j++)
				{
						if (a[i].q & (1 << j))
						 		T[j].modify(1,a[i].l,a[i].r);
				}
		}
		for (int i = 1; i <= m; i++)
		{
				for (int j = 0; j < MAXLOG; j++)
				{
						if (a[i].q & (1 << j)) continue;
						if (T[j].query(1,a[i].l,a[i].r) == a[i].r - a[i].l + 1)
						{
								printf("NO\n");
								return 0;
						}
				}
		}
		printf("YES\n");
		for (int i = 1; i <= n; i++)
		{
				int res = 0;
				for (int j = 0; j < MAXLOG; j++)
				{
						if (T[j].query(1,i,i))
								res += 1 << j;
				}
				printf("%d ",res);
		}
		printf("\n");

		return 0;

}


#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
#define MAXLOG 31

struct query
{
		int l , r , q;
} a[MAXN];

int n , m;
int value[MAXN],cnt[MAXN];

struct SegmentTree
{
		struct Node
		{
				int l , r , val;
		} Tree[MAXN << 2];
		inline void build(int index,int l,int r)
		{
				Tree[index].l = l;
				Tree[index].r = r;
				if (l == r)
				{
						Tree[index].val = value[l];
						return;
				}
				int mid = (l + r) >> 1;
				build(index << 1,l,mid);
				build(index << 1 | 1,mid + 1,r);
				update(index);
		}
		inline void update(int index)
		{
				Tree[index].val = Tree[index << 1].val & Tree[index << 1 | 1].val;
		}
		inline int query(int index,int l,int r)
		{
				if (Tree[index].l == l && Tree[index].r == r) return Tree[index].val;
				int mid = (Tree[index].l + Tree[index].r) >> 1;
				if (mid >= r) return query(index << 1,l,r);
				else if (mid + 1 <= l) return query(index << 1 | 1,l,r);
				else return query(index << 1,l,mid) & query(index << 1 | 1,mid + 1,r);
		}
} T;

template <typename T> inline void chkmax(T &x,T y) { x = max(x,y); }
template <typename T> inline void chkmin(T &x,T y) { x = min(x,y); }
template <typename T> inline void read(T &x)
{
    T f = 1; x = 0;
    char c = getchar();
    for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
    for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
    x *= f;
}

int main()
{

		read(n); read(m);
		for (int i = 1; i <= m; i++)
		{
				read(a[i].l);
				read(a[i].r);
				read(a[i].q);
		}
		for (int i = 0; i < MAXLOG; i++)
		{
				for (int j = 0; j <= n; j++) cnt[j] = 0;
				for (int j = 1; j <= n; j++)
				{
						if (a[j].q & (1 << i))
						{
								cnt[a[j].l]++;
								cnt[a[j].r + 1]--;
						}
				}
				for (int j = 1; j <= n; j++)
				{
						cnt[j] += cnt[j - 1];
						if (cnt[j] > 0)
								value[j] |= (1 << i);
				}
		}
		T.build(1,1,n);
		for (int i = 1; i <= m; i++)
		{
				if (T.query(1,a[i].l,a[i].r) != a[i].q)
				{
						printf("NO\n");
						return 0;
				}
		}
		printf("YES\n");
		for (int i = 1; i <= n; i++) printf("%d ",value[i]);
		printf("\n");

		return 0;

}


#include <bits/stdc++.h>

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int, int>

#define all(s) s.begin(), s.end()
#define fast_io cin.tie(0), ios_base :: sync_with_stdio(0)
#define fname "A."

using namespace std;

typedef long long ll;

const int maxn = (int)1e5 + 100;

int n;

bitset <(ll)maxn> st[30];

int m, l, r, x;

int res[maxn];

int main() {
  #ifdef OFFLINE
    assert(freopen(fname"in", "r", stdin));
    assert(freopen(fname"out", "w", stdout));
  #endif // OFFLINE
  scanf("%d%d", &n, &m);

  for (int i = 0; i < 30; i++)
      st[i].set();

  while (m--) {
    scanf("%d%d%d", &l, &r, &x);
    for (int i = 0; i < 30; i++)
      if ((x >> i) & 1) {
        int nx = st[i]._Find_next(l - 1);
        while (nx <= r) {
          st[i].set(nx, 0);
          nx = st[i]._Find_next(l - 1);
        }
      }
      else if (st[i]._Find_next(l - 1) > r){
        puts("NO");
        return 0;
      }
  }
  puts("YES");
  for (int j = 0; j < 30; j++)
    for (int i = 1; i <= n; i++)
      if (st[j][i] == 0)
        res[i] += (1 << j);

  for (int i = 1; i <= n; i++)
    printf ("%d ", res[i]);

return 0;
}


#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

const int maxn = 1e5 + 10;

struct Tree{
    int t[4 * maxn];
    char lz[4 * maxn];
    inline int get(int l, int r, int v = 1, int tl = 1, int tr = maxn - 1){
        if(lz[v]){
            t[v] = (tr - tl + 1);
            if(tl != tr)
                lz[v + v] = lz[v + v + 1] = 1;
            lz[v] = 0;
        }
        if(l > r || tl > r || tr < l)
            return 0;
        if(l <= tl && tr <= r)
            return t[v];
        int tm = (tl + tr) >> 1;
        return get(l, r, v + v, tl, tm) + get(l, r, v + v + 1, tm + 1, tr);
    }
    inline void upd(int l, int r, int v = 1, int tl = 1, int tr = maxn - 1){
        if(lz[v]){
            t[v] = (tr - tl + 1);
            if(tl != tr)
                lz[v + v] = lz[v + v + 1] = 1;
            lz[v] = 0;
        }
        if(l > r || tl > r || tr < l)
            return;
        if(l <= tl && tr <= r){
            lz[v] = 1;
            if(lz[v]){
                t[v] = (tr - tl + 1);
                if(tl != tr)
                    lz[v + v] = lz[v + v + 1] = 1;
                lz[v] = 0;
            }
            return;
        }
        int tm = (tl + tr) >> 1;
        upd(l, r, v + v, tl, tm);
        upd(l, r, v + v + 1, tm + 1, tr);
        t[v] = t[v + v] + t[v + v + 1];
    }
} T[31];

inline bool bit(int mask, int pos){
    return (mask >> pos) & 1;
}

void No(){
    puts("NO");
    exit(0);
}

int n, m;

int main(){
    int l, r, q;
    scanf("%d%d", &n, &m);
    rep(i, m){
        scanf("%d%d%d", &l, &r, &q);
        rep(k, 31){
            if(bit(q, k))
                T[k].upd(l, r);
            else {
                if(T[k].get(l, r) == r - l + 1)
                    No();
            }
        }
    }
    puts("YES");
    rep(ci, n){
        int i = ci + 1;
        int res = 0;
        rep(k, 31)
            if(T[k].get(i, i))
                res += (1 << k);
        printf("%d ", res);
    }
return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int, int>

#define all(s) s.begin(), s.end()
#define fast_io cin.tie(0), ios_base :: sync_with_stdio(0)
#define fname "A."

using namespace std;

typedef long long ll;

const int maxn = (int)1e5 + 100;

int n;

struct dsu {
  int par[maxn];
  void init() {
    for (int i = 0; i < maxn; i++)
      par[i] = i;
  }
  int getpar(int v) {
    return (par[v] == v ? v : par[v] = getpar(par[v]));
  }
} st[30];

int m, l, r, x;

int res[maxn];

bool color[30][maxn];

int main() {
  #ifdef OFFLINE
    assert(freopen(fname"in", "r", stdin));
    assert(freopen(fname"out", "w", stdout));
  #endif // OFFLINE
  scanf("%d%d", &n, &m);

  for (int i = 0; i < 30; i++)
      st[i].init();

  while (m--) {
    scanf("%d%d%d", &l, &r, &x);
    for (int i = 0; i < 30; i++)
      if ((x >> i) & 1) {
        for (int v = l; ;) {
          v = st[i].getpar(v);
          if (v > r)
            break;
          color[i][v] = 1;
          st[i].par[v] = v + 1;
        }
      }
      else if (st[i].getpar(l) > r){
        puts("NO");
        return 0;
      }
  }
  puts("YES");
  for (int j = 0; j < 30; j++)
    for (int i = 1; i <= n; i++)
      if (color[j][i] == 1)
        res[i] += (1 << j);

  for (int i = 1; i <= n; i++)
    printf ("%d ", res[i]);

return 0;
}


#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

const int maxn = 1e5 + 10;

int t[31][4 * maxn], n, m;
vector<vector<bool> > lz(31, vector<bool> (4 * maxn, 0));

void upd(int k, int l, int r, int v = 1, int tl = 1, int tr = n){
    if(lz[k][v]){
        t[k][v] = tr - tl + 1;
        if(tl != tr)
            lz[k][v + v] = lz[k][v + v + 1] = 1;
        lz[k][v] = 0;
    }
    if(l > r || tl > r || tr < l)
        return;
    if(l <= tl && tr <= r){
        lz[k][v] = 1;
        if(lz[k][v]){
            t[k][v] = tr - tl + 1;
            if(tl != tr)
                lz[k][v + v] = lz[k][v + v + 1] = 1;
            lz[k][v] = 0;
        }
        return;
    }
    int tm = (tl + tr) >> 1;
    upd(k, l, r, v + v, tl, tm);
    upd(k, l, r, v + v + 1, tm + 1, tr);
    t[k][v] = t[k][v + v] + t[k][v + v + 1];
}

int get(int k, int l, int r, int v = 1, int tl = 1, int tr = n){
    if(lz[k][v]){
        t[k][v] = tr - tl + 1;
        if(tl != tr)
            lz[k][v + v] = lz[k][v + v + 1] = 1;
        lz[k][v] = 0;
    }
    if(l > r || tl > r || tr < l)
        return 0;
    if(l <= tl && tr <= r)
        return t[k][v];
    int tm = (tl + tr) >> 1;
    return get(k, l, r, v + v, tl, tm) + get(k, l, r, v + v + 1, tm + 1, tr);
}

inline bool bit(int mask, int pos){
    return (mask >> pos) & 1;
}

void No(){
    puts("NO");
    exit(0);
}

int main(){
    int l, r, q;
    scanf("%d%d", &n, &m);
    rep(i, m){
        scanf("%d%d%d", &l, &r, &q);
        rep(k, 31){
            if(bit(q, k))
                upd(k, l, r);
            else {
                if(get(k, l, r) == r - l + 1)
                    No();
            }
        }
    }
    puts("YES");
    rep(ci, n){
        int i = ci + 1;
        int res = 0;
        rep(k, 31)
            if(get(k, i, i))
                res += (1 << k);
        printf("%d ", res);
    }
return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int, int>

#define all(s) s.begin(), s.end()
#define fast_io cin.tie(0), ios_base :: sync_with_stdio(0)
#define fname "A."

using namespace std;

typedef long long ll;

const int maxn = (int)1e5 + 100;

int n;

struct dsu {
  int par[maxn];
  void init() {
    for (int i = 0; i < maxn; i++)
      par[i] = i;
  }
  int getpar(int v) {
    return (par[v] == v ? v : par[v] = getpar(par[v]));
  }
} st[30];

int m, l, r, x;

int res[maxn];

bool color[30][maxn];

map <pii, int> was;

int main() {
  #ifdef OFFLINE
    assert(freopen(fname"in", "r", stdin));
    assert(freopen(fname"out", "w", stdout));
  #endif // OFFLINE
  scanf("%d%d", &n, &m);

  for (int i = 0; i < 30; i++)
      st[i].init();

  while (m--) {
    scanf("%d%d%d", &l, &r, &x);
    if (was[{l, r}] != x) {
      puts("NO");
      return 0;
    }
    was[{l, r}] = x;
    for (int i = 0; i < 30; i++)
      if ((x >> i) & 1) {
        for (int v = l; ;) {
          v = st[i].getpar(v);
          if (v > r)
            break;
          color[i][v] = 1;
          st[i].par[v] = v + 1;
        }
      }
      else if (st[i].getpar(l) > r){
        puts("NO");
        return 0;
      }
  }
  puts("YES");
  for (int j = 0; j < 30; j++)
    for (int i = 1; i <= n; i++)
      if (color[j][i] == 1)
        res[i] += (1 << j);

  for (int i = 1; i <= n; i++)
    printf ("%d ", res[i]);

return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int, int>

#define all(s) s.begin(), s.end()
#define fast_io cin.tie(0), ios_base :: sync_with_stdio(0)
#define fname "A."

using namespace std;

typedef long long ll;

const int maxn = (int)1e5 + 100;

int n;

bitset <maxn> st[30];

int m, l, r, x;

int res[maxn];

int main() {
  #ifdef OFFLINE
    assert(freopen(fname"in", "r", stdin));
    assert(freopen(fname"out", "w", stdout));
  #endif // OFFLINE
  scanf("%d%d", &n, &m);

  for (int i = 0; i < 30; i++)
      st[i].set();

  while (m--) {
    scanf("%d%d%d", &l, &r, &x);
    for (int i = 0; i < 30; i++)
      if ((x >> i) & 1) {
        int nx = st[i]._Find_next(l - 1);
        while (nx <= r) {
          st[i].set(nx, 0);
          nx = st[i]._Find_next(l - 1);
        }
      }
      else if (st[i]._Find_next(l - 1) > r){
        puts("NO");
        return 0;
      }
  }
  puts("YES");
  for (int j = 0; j < 30; j++)
    for (int i = 1; i <= n; i++)
      if (st[j][i] == 0)
        res[i] += (1 << j);

  for (int i = 1; i <= n; i++)
    printf ("%d ", res[i]);

return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int, int>

#define all(s) s.begin(), s.end()
#define fast_io cin.tie(0), ios_base :: sync_with_stdio(0)
#define fname "A."

using namespace std;

typedef long long ll;

const int maxn = (int)1e5 + 100;

int n;

struct dsu {
  int par[maxn];
  void init() {
    for (int i = 0; i < maxn; i++)
      par[i] = i;
  }
  int getpar(int v) {
    return (par[v] == v ? v : par[v] = getpar(par[v]));
  }
} st[30];

int m, l, r, x;

int res[maxn];

bool color[30][maxn];

map <pii, int> was;

int main() {
  #ifdef OFFLINE
    assert(freopen(fname"in", "r", stdin));
    assert(freopen(fname"out", "w", stdout));
  #endif // OFFLINE
  scanf("%d%d", &n, &m);

  for (int i = 0; i < 30; i++)
      st[i].init();

  while (m--) {
    scanf("%d%d%d", &l, &r, &x);
    if (was.count({l, r}) && was[{l, r}] != x) {
      puts("NO");
      return 0;
    }
    was[{l, r}] = x;
    for (int i = 0; i < 30; i++)
      if ((x >> i) & 1) {
        for (int v = l; ;) {
          v = st[i].getpar(v);
          if (v > r)
            break;
          color[i][v] = 1;
          st[i].par[v] = v + 1;
        }
      }
      else if (st[i].getpar(l) > r){
        puts("NO");
        return 0;
      }
  }
  puts("YES");
  for (int j = 0; j < 30; j++)
    for (int i = 1; i <= n; i++)
      if (color[j][i] == 1)
        res[i] += (1 << j);

  for (int i = 1; i <= n; i++)
    printf ("%d ", res[i]);

return 0;
}


#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

const int maxn = 1e5 + 1000;

struct Tree{
    int t[4 * maxn];
    bool lz[4 * maxn];
    inline void push(int v, int tl, int tr){
        if(lz[v]){
            t[v] = (tr - tl + 1);
            if(tl != tr)
                lz[v + v] = lz[v + v + 1] = 1;
            lz[v] = 0;
        }
    }
    int get(int l, int r, int v = 1, int tl = 1, int tr = maxn - 1){
        push(v, tl, tr);
        if(l > r || tl > r || tr < l)
            return 0;
        if(l <= tl && tr <= r)
            return t[v];
        int tm = (tl + tr) >> 1;
        return get(l, r, v + v, tl, tm) + get(l, r, v + v + 1, tm + 1, tr);
    }
    void upd(int l, int r, int v = 1, int tl = 1, int tr = maxn - 1){
        push(v, tl, tr);
        if(l > r || tl > r || tr < l)
            return;
        if(l <= tl && tr <= r){
            lz[v] = 1;
            push(v, tl, tr);
            return;
        }
        int tm = (tl + tr) >> 1;
        upd(l, r, v + v, tl, tm);
        upd(l, r, v + v + 1, tm + 1, tr);
        t[v] = t[v + v] + t[v + v + 1];
    }
} T[31];

inline bool bit(int mask, int pos){
    return (mask >> pos) & 1;
}

void No(){
    puts("NO");
    exit(0);
}

int n, m;

int main(){
    int l, r, q;
    scanf("%d%d", &n, &m);
    rep(i, m){
        scanf("%d%d%d", &l, &r, &q);
        rep(k, 31){
            if(bit(q, k))
                T[k].upd(l, r);
            else {
                if(T[k].get(l, r) == r - l + 1)
                    No();
            }
        }
    }
    puts("YES");
    rep(ci, n){
        int i = ci + 1;
        int res = 0;
        rep(k, 31)
            if(T[k].get(i, i))
                res += (1 << k);
        printf("%d ", res);
    }
return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int, int>

#define all(s) s.begin(), s.end()
#define fast_io cin.tie(0), ios_base :: sync_with_stdio(0)
#define fname "A."

using namespace std;

typedef long long ll;

const int maxn = 1e5 + 100;

inline bool bit(int mask, int pos) {
  return (mask >> pos) & 1;
}

int t[30][maxn];

inline void upd(int id, int pos, int val) {
  for (; pos < maxn; pos |= pos + 1)
    t[id][pos] += val;
}
inline int get(int id, int pos) {
  int res = 0;
  for (; pos >= 0; pos = (pos & (pos + 1)) - 1)
    res += t[id][pos];
  return res;
}
inline int get(int id, int l, int r) {
  return get(id, r) - (l > 0 ? get(id, l - 1) : 0);
}

int n;

bitset <maxn> st[30];

inline int nxt0(int id, int pos) {
  int l = pos, r = n, mid, ans = -1;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (get(id, pos, mid) != mid - pos + 1)
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  return ans;
}

inline void setval (int id, int l, int r) {
  while (get(id, l, r) != r - l + 1) {
    int nx = st[id]._Find_next(l - 1);
    st[id].set(nx, 0);
    upd(id, nx, 1);
  }
}

int m, l, r, x;

inline void solve () {
  for (int i = 0; i < 30; i++)
    if (bit(x, i))
      setval(i, l, r);
    else if (get(i, l, r) == r - l + 1){
      puts("NO");
      exit(0);
    }
}

int main() {
  #ifdef OFFLINE
    assert(freopen(fname"in", "r", stdin));
    assert(freopen(fname"out", "w", stdout));
  #endif // OFFLINE
  scanf("%d%d", &n, &m);

  for (int i = 0; i < 30; i++)
    for (int j = 1; j <= n; j++)
      st[i].set(j, 1);

  while (m--) {
    scanf("%d%d%d", &l, &r, &x);
    solve();
  }
  puts("YES");
  for (int i = 1; i <= n; i++){
    int res = 0;
    for (int j = 0; j < 30; j++)
      if(get(j, i, i))
        res += (1 << j);
    printf("%d ", res);
  }

return 0;
}


#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

const int maxn = 1e5 + 10;

int t[31][4 * maxn], n, m;
bool lz[31][maxn];

inline void upd(int k, int l, int r, int v = 1, int tl = 1, int tr = n){
    if(lz[k][v]){
        t[k][v] = tr - tl + 1;
        if(tl != tr)
            lz[k][v + v] = lz[k][v + v + 1] = 1;
        lz[k][v] = 0;
    }
    if(l > r || tl > r || tr < l)
        return;
    if(l <= tl && tr <= r){
        lz[k][v] = 1;
        if(lz[k][v]){
            t[k][v] = tr - tl + 1;
            if(tl != tr)
                lz[k][v + v] = lz[k][v + v + 1] = 1;
            lz[k][v] = 0;
        }
        return;
    }
    int tm = (tl + tr) >> 1;
    upd(k, l, r, v + v, tl, tm);
    upd(k, l, r, v + v + 1, tm + 1, tr);
    t[k][v] = t[k][v + v] + t[k][v + v + 1];
}

inline int get(int k, int l, int r, int v = 1, int tl = 1, int tr = n){
    if(lz[k][v]){
        t[k][v] = tr - tl + 1;
        if(tl != tr)
            lz[k][v + v] = lz[k][v + v + 1] = 1;
        lz[k][v] = 0;
    }
    if(l > r || tl > r || tr < l)
        return 0;
    if(l <= tl && tr <= r)
        return t[k][v];
    int tm = (tl + tr) >> 1;
    return get(k, l, r, v + v, tl, tm) + get(k, l, r, v + v + 1, tm + 1, tr);
}

inline bool bit(int mask, int pos){
    return (mask >> pos) & 1;
}

void No(){
    puts("NO");
    exit(0);
}

int main(){
    int l, r, q;
    scanf("%d%d", &n, &m);
    rep(i, m){
        scanf("%d%d%d", &l, &r, &q);
        rep(k, 31){
            if(bit(q, k))
                upd(k, l, r);
            else {
                if(get(k, l, r) == r - l + 1)
                    No();
            }
        }
    }
    puts("YES");
    rep(ci, n){
        int i = ci + 1;
        int res = 0;
        rep(k, 31)
            if(get(k, i, i))
                res += (1 << k);
        printf("%d ", res);
    }
return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int, int>

#define all(s) s.begin(), s.end()
#define fast_io cin.tie(0), ios_base :: sync_with_stdio(0)
#define fname "A."

using namespace std;

typedef long long ll;

const int maxn = 1e5 + 100;

inline bool bit(int mask, int pos) {
  return (mask >> pos) & 1;
}

int t[30][maxn];

inline void upd(int id, int pos, int val) {
  for (; pos < maxn; pos |= pos + 1)
    t[id][pos] += val;
}
inline int get(int id, int pos) {
  int res = 0;
  for (; pos >= 0; pos = (pos & (pos + 1)) - 1)
    res += t[id][pos];
  return res;
}
inline int get(int id, int l, int r) {
  return get(id, r) - (l > 0 ? get(id, l - 1) : 0);
}

int n;

inline int nxt0(int id, int pos) {
  int l = pos, r = n, mid, ans = -1;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (get(id, pos, mid) != mid - pos + 1)
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  return ans;
}

inline void setval (int id, int l, int r) {
  while (true) {
    int nx = nxt0(id, l);
    if (nx == -1 || nx > r)
      break;
    upd(id, nx, 1);
  }
}

int m, l, r, x;

inline void solve () {
  for (int i = 0; i < 30; i++)
    if (bit(x, i))
      setval(i, l, r);
    else if (get(i, l, r) == r - l + 1){
      cout << "NO";
      exit(0);
    }
}

int main() {
  fast_io;
  #ifdef OFFLINE
    assert(freopen(fname"in", "r", stdin));
    assert(freopen(fname"out", "w", stdout));
  #endif // OFFLINE
  cin >> n >> m;
  while (m--) {
    cin >> l >> r >> x;
    solve();
  }
  cout << "YES\n";
  for (int i = 1; i <= n; i++){
    ll res = 0;
    for (int j = 0; j < 30; j++)
      res += get(j, i, i) * 1ll * (1 << j);
    cout << res << " ";
  }

return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int, int>

#define all(s) s.begin(), s.end()
#define fast_io cin.tie(0), ios_base :: sync_with_stdio(0)
#define fname "A."

using namespace std;

typedef long long ll;

const int maxn = 1e5 + 100;

inline bool bit(int mask, int pos) {
  return (mask >> pos) & 1;
}

int n;

bitset <maxn> st[30];

inline void setval (int id, int l, int r) {
  int nx = st[id]._Find_next(l - 1);
  while (nx <= r) {
    st[id].set(nx, 0);
    nx = st[id]._Find_next(l - 1);
  }
}

int m, l, r, x;

inline void solve () {
  for (int i = 0; i < 30; i++)
    if (bit(x, i))
      setval(i, l, r);
    else if (st[i]._Find_next(l - 1) > r){
      puts("NO");
      exit(0);
    }
}

int main() {
  #ifdef OFFLINE
    assert(freopen(fname"in", "r", stdin));
    assert(freopen(fname"out", "w", stdout));
  #endif // OFFLINE
  scanf("%d%d", &n, &m);

  for (int i = 0; i < 30; i++)
    for (int j = 1; j <= n + 1; j++)
      st[i].set(j, 1);

  while (m--) {
    scanf("%d%d%d", &l, &r, &x);
    solve();
  }
  puts("YES");
  for (int i = 1; i <= n; i++){
    int res = 0;
    for (int j = 0; j < 30; j++)
      if(!st[j][i])
        res += (1 << j);
    printf("%d ", res);
  }

return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int, int>

#define all(s) s.begin(), s.end()
#define fast_io cin.tie(0), ios_base :: sync_with_stdio(0)
#define fname "A."

using namespace std;

typedef long long ll;

const int maxn = 1e5 + 100;

int t[30][maxn * 4];
bool lz[30][maxn * 4];

inline void push(int id, int v, int tl, int tr) {
  if (lz[id][v]) {
    t[id][v] = (tr - tl + 1);
    if (tl != tr)
      lz[id][v + v] = lz[id][v + v + 1] = 1;
    lz[id][v] = 0;
  }
}

void upd(int id, int v, int tl, int tr, int l, int r) {
  push(id, v, tl, tr);
  if (l > r || tl > r || l > tr)
    return;
  if (l <= tl && tr <= r) {
    lz[id][v] = 1;
    push(id, v, tl, tr);
    return;
  }
  int tm = (tl + tr) >> 1;
  upd(id, v + v, tl, tm, l, r);
  upd(id, v + v + 1, tm + 1, tr, l, r);
  t[id][v] = t[id][v + v] + t[id][v + v + 1];
}

int get(int id, int v, int tl, int tr, int l, int r) {
  push(id, v, tl, tr);
  if (l > r || tl > r || l > tr)
    return 0;
  if (l <= tl && tr <= r)
    return t[id][v];
  int tm = (tl + tr) >> 1;
  return get(id, v + v, tl, tm, l, r) + get(id, v + v + 1, tm + 1, tr, l, r);
}

int n, m, l, r, x;

inline bool bit(int mask, int pos) {
  return (mask >> pos) & 1;
}

int main() {
  fast_io;
  #ifdef OFFLINE
    assert(freopen(fname"in", "r", stdin));
    assert(freopen(fname"out", "w", stdout));
  #endif // OFFLINE
  cin >> n >> m;
  while (m--) {
    cin >> l >> r >> x;
    for (int i = 0; i < 30; i++)
      if (bit(x, i))
        upd(i, 1, 1, n, l, r);
      else if (get(i, 1, 1, n, l, r) == r - l + 1) {
        cout << "NO";
        return 0;
      }
  }
  cout << "YES\n";
  int cur;
  for (int i = 1; i <= n; i++) {
    cur = 0;
    for (int j = 0; j < 30; j++)
      cur += get(j, 1, 1, n, i, i) * 1ll * (1 << j);
    cout << cur << " ";
  }
return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
int ans[450000][35];
int sum[450000];
int f[450000];
int ll,rr,xx;
void build(int pl,int pr,int x)
{
    if(pl==pr)f[pl]=x;
    else
    {
        int mid=(pl+pr)/2;
        build(pl,mid,2*x);
        build(mid+1,pr,2*x+1);
    }
}
void pushdown(int pl,int pr,int x)
{
    if(pl==pr)return;
    int mid=(pl+pr)/2;
    if(sum[x])
    {
        sum[2*x]=1;
        sum[2*x+1]=1;
    }
    pushdown(pl,mid,2*x);
    pushdown(mid+1,pr,2*x+1);
}
void change(int pl,int pr,int x)
{
    if(pl>=ll&&pr<=rr)
        sum[x]=1;
    else
    {
        sum[x<<1]=max(sum[x],sum[x<<1]);
        sum[(x<<1)+1]=max(sum[x],sum[(x<<1)+1]);
        int m=(pl+pr)>>1;
        if(ll<=m)change(pl,m,x<<1);
        if(rr>=m+1)change(m+1,pr,(x<<1)+1);
        if(sum[x<<1]&&sum[(x<<1)+1])sum[x]=1;
    }
}
int findsum(int pl,int pr,int x)
{//printf("%d %d %d %d\n",pl,pr,ll,rr);
    if(pl<=ll&&pr>=rr&&sum[x])return(rr-ll+1);
    if(pl>=ll&&pr<=rr)if(sum[x])return(pr-pl+1);else return 0;
    else
    {
        sum[x<<1]=max(sum[x],sum[x<<1]);
        sum[(x<<1)+1]=max(sum[x],sum[(x<<1)+1]);
        int m=(pl+pr)>>1;int ans=0;
        if(ll<=m)ans+=findsum(pl,m,x<<1);
        if(rr>=m+1)ans+=findsum(m+1,pr,(x<<1)+1);
        return ans;
    }
}
int main()
{
    int n,m,i,j,k,s,t,ok;
    int l[110000],r[110000],q[110000];
    scanf("%d%d",&n,&m);
    ok=1;
    build(1,n,1);
    for(i=1;i<=m;i++)
        scanf("%d%d%d",&l[i],&r[i],&q[i]);
    for(i=0;i<=30;i++)
    {//printf("!");
        memset(sum,0,sizeof(sum));
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))!=0)
            {
                ll=l[j];rr=r[j];xx=1;//printf("<%d?%d %d?>",i,l[j],r[j]);
                change(1,n,1);
            }
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))==0)
            {
                ll=l[j];rr=r[j];//if(i<4)printf("<%d %d>",l[j],r[j]);
                s=findsum(1,n,1);//if(i<4)printf("%d\n",s);
                if(s>=rr-ll+1)ok=0;
            }
        if(ok==0)break;
        pushdown(1,n,1);
        for(j=1;j<=n;j++)
        {
            ans[j][i]=sum[f[j]];
        }//printf("-!");
    }
    if(ok)
    {
        printf("YES\n");
        for(i=1;i<=n;i++)
        {
            s=0;
            for(j=0;j<=30;j++)
                s+=(1<<j)*ans[i][j];
            printf("%d ",s);
        }
    }else
     printf("NO\n");
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
int ans[500000][35];
int sum[500000];
int ll,rr,xx;
void change(int pl,int pr,int x)
{
    if(pl>=ll&&pr<=rr)
      {
         sum[x]=1;
      }
    else
    {
        sum[2*x]=max(sum[x],sum[2*x]);
        sum[2*x+1]=max(sum[x],sum[2*x+1]);
        int m=(pl+pr)/2;
        if(ll<=m)change(pl,m,2*x);
        if(rr>=m+1)change(m+1,pr,2*x+1);
        if(sum[2*x]&&sum[2*x+1])sum[x]=1;
    }
}
int findsum(int pl,int pr,int x)
{//printf("%d %d %d %d\n",pl,pr,ll,rr);
    if(pl<=ll&&pr>=rr&&sum[x]);return(rr-ll+1);
    if(pl>=ll&&pr<=rr)if(sum[x])return(pr-pl+1);else return 0;
    else
    {
        sum[2*x]=max(sum[x],sum[2*x]);
        sum[2*x+1]=max(sum[x],sum[2*x+1]);
        int m=(pl+pr)/2;int ans=0;
        if(ll<=m)ans+=findsum(pl,m,2*x);
        if(rr>=m+1)ans+=findsum(m+1,pr,2*x+1);
        return ans;
    }
}
int main()
 {
     int n,m,i,j,k,s,t,ok;
    int l[110000],r[110000],q[110000];
    scanf("%d%d",&n,&m);
    ok=1;
    for(i=1;i<=m;i++)
        scanf("%d%d%d",&l[i],&r[i],&q[i]);
    for(i=0;i<=30;i++)
    {//printf("!");
        memset(sum,0,sizeof(sum));
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))!=0)
            {
                ll=l[j];rr=r[j];xx=1;//printf("<%d?%d %d?>",i,l[j],r[j]);
                change(1,n,1);
            }
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))==0)
            {
                ll=l[j];rr=r[j];//if(i<4)printf("<%d %d>",l[j],r[j]);
                s=findsum(1,n,1);//if(i<4)printf("%d\n",s);
                if(s>=rr-ll+1)ok=0;
            }
        if(ok==0)break;
        for(j=1;j<=n;j++)
        {
            ll=j;rr=j;ans[j][i]=findsum(1,n,1);
        }//printf("-!");
    }
    if(ok)
    {
        printf("YES\n");
        for(i=1;i<=n;i++)
        {
            s=0;
            for(j=0;j<=30;j++)
                s+=(1<<j)*ans[i][j];
            printf("%d ",s);
        }
    }else
     printf("NO\n");
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
int ans[300000][35];
int sum[300000];
int ll,rr,xx;
void change(int pl,int pr,int x)
{
    if(pl>=ll&&pr<=rr)
        sum[x]=1;
    else
    {
        sum[2*x]=max(sum[x],sum[2*x]);
        sum[2*x+1]=max(sum[x],sum[2*x+1]);
        int m=(pl+pr)/2;
        if(ll<=m)change(pl,m,2*x);
        if(rr>=m+1)change(m+1,pr,2*x+1);
        if(sum[2*x]&&sum[2*x+1])sum[x]=1;
    }
}
int findsum(int pl,int pr,int x)
{//printf("%d %d %d %d\n",pl,pr,ll,rr);
    if(pl>=ll&&pr<=rr)if(sum[x])return(pr-pl+1);else return 0;
    else
    {
        sum[2*x]=max(sum[x],sum[2*x]);
        sum[2*x+1]=max(sum[x],sum[2*x+1]);
        int m=(pl+pr)/2;int ans=0;
        if(ll<=m)ans+=findsum(pl,m,2*x);
        if(rr>=m+1)ans+=findsum(m+1,pr,2*x+1);
        return ans;
    }
}
int main()
{
    int n,m,i,j,k,s,t,ok;
    int l[110000],r[110000],q[110000];
    scanf("%d%d",&n,&m);
    ok=1;
    for(i=1;i<=m;i++)
        scanf("%d%d%d",&l[i],&r[i],&q[i]);
    for(i=0;i<=30;i++)
    {//printf("!");
        memset(sum,0,sizeof(sum));
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))!=0)
            {
                ll=l[j];rr=r[j];xx=1;//printf("<%d?%d %d?>",i,l[j],r[j]);
                change(1,n,1);
            }
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))==0)
            {
                ll=l[j];rr=r[j];//if(i<4)printf("<%d %d>",l[j],r[j]);
                s=findsum(1,n,1);//if(i<4)printf("%d\n",s);
                if(s>=rr-ll+1)ok=0;
            }
        if(ok==0)break;
        for(j=1;j<=n;j++)
        {
            ll=j;rr=j;ans[j][i]=findsum(1,n,1);
        }//printf("-!");
    }
    if(ok)
    {
        printf("YES\n");
        for(i=1;i<=n;i++)
        {
            s=0;
            for(j=0;j<=30;j++)
                s+=(1<<j)*ans[i][j];
            printf("%d ",s);
        }
    }else
     printf("NO\n");
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
int ans[300000][35];
int sum[300000];
int f[300000];
int ll,rr,xx;
void build(int pl,int pr,int x)
{
    if(pl==pr)f[pl]=x;
    else
    {
        int mid=(pl+pr)/2;
        build(pl,mid,2*x);
        build(mid+1,pr,2*x+1);
    }
}
void pushdown(int pl,int pr,int x)
{
    if(pl==pr)return;
    int mid=(pl+pr)/2;
    if(sum[x])
    {
        sum[2*x]=1;
        sum[2*x+1]=1;
    }
    pushdown(pl,mid,2*x);
    pushdown(mid+1,pr,2*x+1);
}
void change(int pl,int pr,int x)
{
    if(pl>=ll&&pr<=rr)
        sum[x]=1;
    else
    {
        sum[x<<1]=max(sum[x],sum[x<<1]);
        sum[(x<<1)+1]=max(sum[x],sum[(x<<1)+1]);
        int m=(pl+pr)>>1;
        if(ll<=m)change(pl,m,x<<1);
        if(rr>=m+1)change(m+1,pr,(x<<1)+1);
        if(sum[x<<1]&&sum[(x<<1)+1])sum[x]=1;
    }
}
int findsum(int pl,int pr,int x)
{//printf("%d %d %d %d\n",pl,pr,ll,rr);
    if(pl<=ll&&pr>=rr&&sum[x])return(rr-ll+1);
    if(pl>=ll&&pr<=rr)if(sum[x])return(pr-pl+1);else return 0;
    else
    {
        sum[x<<1]=max(sum[x],sum[x<<1]);
        sum[(x<<1)+1]=max(sum[x],sum[(x<<1)+1]);
        int m=(pl+pr)>>1;int ans=0;
        if(ll<=m)ans+=findsum(pl,m,x<<1);
        if(rr>=m+1)ans+=findsum(m+1,pr,(x<<1)+1);
        return ans;
    }
}
int main()
{
    int n,m,i,j,k,s,t,ok;
    int l[110000],r[110000],q[110000];
    scanf("%d%d",&n,&m);
    ok=1;
    build(1,n,1);
    for(i=1;i<=m;i++)
        scanf("%d%d%d",&l[i],&r[i],&q[i]);
    for(i=0;i<=29;i++)
    {//printf("!");
        memset(sum,0,sizeof(sum));
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))!=0)
            {
                ll=l[j];rr=r[j];xx=1;//printf("<%d?%d %d?>",i,l[j],r[j]);
                change(1,n,1);
            }
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))==0)
            {
                ll=l[j];rr=r[j];//if(i<4)printf("<%d %d>",l[j],r[j]);
                s=findsum(1,n,1);//if(i<4)printf("%d\n",s);
                if(s>=rr-ll+1)ok=0;
            }
        if(ok==0)break;
        pushdown(1,n,1);
        for(j=1;j<=n;j++)
        {
            ans[j][i]=sum[f[j]];
        }//printf("-!");
    }
    if(ok)
    {
        printf("YES\n");
        for(i=1;i<=n;i++)
        {
            s=0;
            for(j=0;j<=30;j++)
                s+=(1<<j)*ans[i][j];
            printf("%d ",s);
        }
    }else
     printf("NO\n");
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
int ans[300000][35];
int sum[300000];
int ll,rr,xx;
void
void change(int pl,int pr,int x)
{
    if(pl>=ll&&pr<=rr)
      {
         sum[x]=1;
      }
    else
    {
        sum[2*x]=max(sum[x],sum[2*x]);
        sum[2*x+1]=max(sum[x],sum[2*x+1]);
        int m=(pl+pr)/2;
        if(ll<=m)change(pl,m,2*x);
        if(rr>=m+1)change(m+1,pr,2*x+1);
        if(sum[2*x]&&sum[2*x+1])sum[x]=1;
    }
}
int findsum(int pl,int pr,int x)
{//printf("%d %d %d %d\n",pl,pr,ll,rr);
    if(pl<=ll&&pr>=rr&&sum[x]);return(rr-ll+1);
    if(pl>=ll&&pr<=rr)if(sum[x])return(pr-pl+1);else return 0;
    else
    {
        sum[2*x]=max(sum[x],sum[2*x]);
        sum[2*x+1]=max(sum[x],sum[2*x+1]);
        int m=(pl+pr)/2;int ans=0;
        if(ll<=m)ans+=findsum(pl,m,2*x);
        if(rr>=m+1)ans+=findsum(m+1,pr,2*x+1);
        return ans;
    }
}
int main()
    int n,m,i,j,k,s,t,ok;
    int l[110000],r[110000],q[110000];
    scanf("%d%d",&n,&m);
    ok=1;
    for(i=1;i<=m;i++)
        scanf("%d%d%d",&l[i],&r[i],&q[i]);
    for(i=0;i<=30;i++)
    {//printf("!");
        memset(sum,0,sizeof(sum));
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))!=0)
            {
                ll=l[j];rr=r[j];xx=1;//printf("<%d?%d %d?>",i,l[j],r[j]);
                change(1,n,1);
            }
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))==0)
            {
                ll=l[j];rr=r[j];//if(i<4)printf("<%d %d>",l[j],r[j]);
                s=findsum(1,n,1);//if(i<4)printf("%d\n",s);
                if(s>=rr-ll+1)ok=0;
            }
        if(ok==0)break;
        for(j=1;j<=n;j++)
        {
            ll=j;rr=j;ans[j][i]=findsum(1,n,1);
        }//printf("-!");
    }
    if(ok)
    {
        printf("YES\n");
        for(i=1;i<=n;i++)
        {
            s=0;
            for(j=0;j<=30;j++)
                s+=(1<<j)*ans[i][j];
            printf("%d ",s);
        }
    }else
     printf("NO\n");
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
int ans[450000][35];
int sum[450000];
int ll,rr,xx;
void change(int pl,int pr,int x)
{
    if(pl>=ll&&pr<=rr)
        sum[x]=1;
    else
    {
        sum[x<<1]=max(sum[x],sum[x<<1]);
        sum[(x<<1)+1]=max(sum[x],sum[(x<<1)+1]);
        int m=(pl+pr)>>1;
        if(ll<=m)change(pl,m,x<<1);
        if(rr>=m+1)change(m+1,pr,(x<<1)+1);
        if(sum[x<<1]&&sum[(x<<1)+1])sum[x]=1;
    }
}
int findsum(int pl,int pr,int x)
{//printf("%d %d %d %d\n",pl,pr,ll,rr);
    if(pl<=ll&&pr>=rr&&sum[x])return(rr-ll+1);
    if(pl>=ll&&pr<=rr)if(sum[x])return(pr-pl+1);else return 0;
    else
    {
        sum[x<<1]=max(sum[x],sum[x<<1]);
        sum[(x<<1)+1]=max(sum[x],sum[(x<<1)+1]);
        int m=(pl+pr)>>1;int ans=0;
        if(ll<=m)ans+=findsum(pl,m,x<<1);
        if(rr>=m+1)ans+=findsum(m+1,pr,(x<<1)+1);
        return ans;
    }
}
int main()
{
    int n,m,i,j,k,s,t,ok;
    int l[110000],r[110000],q[110000];
    scanf("%d%d",&n,&m);
    ok=1;
    for(i=1;i<=m;i++)
        scanf("%d%d%d",&l[i],&r[i],&q[i]);
    for(i=0;i<=30;i++)
    {//printf("!");
        memset(sum,0,sizeof(sum));
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))!=0)
            {
                ll=l[j];rr=r[j];xx=1;//printf("<%d?%d %d?>",i,l[j],r[j]);
                change(1,n,1);
            }
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))==0)
            {
                ll=l[j];rr=r[j];//if(i<4)printf("<%d %d>",l[j],r[j]);
                s=findsum(1,n,1);//if(i<4)printf("%d\n",s);
                if(s>=rr-ll+1)ok=0;
            }
        if(ok==0)break;
        for(j=1;j<=n;j++)
        {
            ll=j;rr=j;ans[j][i]=findsum(1,n,1);
        }//printf("-!");
    }
    if(ok)
    {
        printf("YES\n");
        for(i=1;i<=n;i++)
        {
            s=0;
            for(j=0;j<=30;j++)
                s+=(1<<j)*ans[i][j];
            printf("%d ",s);
        }
    }else
     printf("NO\n");
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
int ans[300000][35];
int sum[300000];
int f[300000];
int ll,rr,xx;
void build(int pl,int pr,int x)
{
    if(pl==pr)f[pl]=x;
    else
    {
        int mid=(pl+pr)/2;
        build(pl,mid,2*x);
        build(mid+1,pr,2*x+1);
    }
}
void pushdown(int pl,int pr,int x)
{
    if(pl==pr)return;
    int mid=(pl+pr)/2;
    if(sum[x])
    {
        sum[2*x]=1;
        sum[2*x+1]=1;
    }
    pushdown(pl,mid,2*x);
    pushdown(mid+1,pr,2*x+1);
}
void change(int pl,int pr,int x)
{
    if(sum[x]==1)return;
    if(pl>=ll&&pr<=rr)
        sum[x]=1;
    else
    {
        sum[x<<1]=max(sum[x],sum[x<<1]);
        sum[(x<<1)+1]=max(sum[x],sum[(x<<1)+1]);
        int m=(pl+pr)>>1;
        if(ll<=m)change(pl,m,x<<1);
        if(rr>=m+1)change(m+1,pr,(x<<1)+1);
        if(sum[x<<1]&&sum[(x<<1)+1])sum[x]=1;
    }
}
int findsum(int pl,int pr,int x)
{//printf("%d %d %d %d\n",pl,pr,ll,rr);
    if(pl<=ll&&pr>=rr&&sum[x])return(rr-ll+1);
    if(pl>=ll&&pr<=rr)if(sum[x])return(pr-pl+1);else return 0;
    else
    {
        sum[x<<1]=max(sum[x],sum[x<<1]);
        sum[(x<<1)+1]=max(sum[x],sum[(x<<1)+1]);
        int m=(pl+pr)>>1;int ans=0;
        if(ll<=m)ans+=findsum(pl,m,x<<1);
        if(rr>=m+1)ans+=findsum(m+1,pr,(x<<1)+1);
        return ans;
    }
}
int scan () {
 char ch = ' ';
 while (ch < '0'|| ch > '9') ch = getchar ();
 int x = 0;
 while (ch <= '9' && ch >= '0') x = x*10+ch-'0', ch = getchar ();
 return x;
}
int main()
{
    int n,m,i,j,k,s,t,ok;
    int l[110000],r[110000],q[110000];
    scanf("%d%d",&n,&m);
    ok=1;
    build(1,n,1);
    for(i=1;i<=m;i++)
    {
        l[i]=scan();r[i]=scan();q[i]=scan();
    }
    for(i=0;i<=29;i++)
    {
        memset(sum,0,sizeof(sum));
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))!=0)
            {
                ll=l[j];rr=r[j];xx=1;
                change(1,n,1);
            }
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))==0)
            {
                ll=l[j];rr=r[j];
                s=findsum(1,n,1);
                if(s>=rr-ll+1)ok=0;
            }
        if(ok==0)break;
        pushdown(1,n,1);
        for(j=1;j<=n;j++)
        {
            ans[j][i]=sum[f[j]];
        }//printf("-!");
    }
    if(ok)
    {
        printf("YES\n");
        for(i=1;i<=n;i++)
        {
            s=0;
            for(j=0;j<=29;j++)
                s+=(1<<j)*ans[i][j];
            printf("%d ",s);
        }
    }else
     printf("NO\n");
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
int ans[450000][35];
int sum[450000];
int ll,rr,xx;
void change(int pl,int pr,int x)
{
    if(pl>=ll&&pr<=rr)
        sum[x]=1;
    else
    {
        sum[x<<1]=max(sum[x],sum[2<<1]);
        sum[(x<<1)+1]=max(sum[x],sum[(x<<1)+1]);
        int m=(pl+pr)>>1;
        if(ll<=m)change(pl,m,x<<1);
        if(rr>=m+1)change(m+1,pr,(x<<1)+1);
        if(sum[x<<1]&&sum[(x<<1)+1])sum[x]=1;
    }
}
int findsum(int pl,int pr,int x)
{//printf("%d %d %d %d\n",pl,pr,ll,rr);
    if(pl<=ll&&pr>=rr&&sum[x])return(rr-ll+1);
    if(pl>=ll&&pr<=rr)if(sum[x])return(pr-pl+1);else return 0;
    else
    {
        sum[x<<1]=max(sum[x],sum[x<<1]);
        sum[(x<<1)+1]=max(sum[x],sum[(x<<1)+1]);
        int m=(pl+pr)>>1;int ans=0;
        if(ll<=m)ans+=findsum(pl,m,x<<1);
        if(rr>=m+1)ans+=findsum(m+1,pr,(x<<1)+1);
        return ans;
    }
}
int main()
{
    int n,m,i,j,k,s,t,ok;
    int l[110000],r[110000],q[110000];
    scanf("%d%d",&n,&m);
    ok=1;
    for(i=1;i<=m;i++)
        scanf("%d%d%d",&l[i],&r[i],&q[i]);
    for(i=0;i<=30;i++)
    {//printf("!");
        memset(sum,0,sizeof(sum));
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))!=0)
            {
                ll=l[j];rr=r[j];xx=1;//printf("<%d?%d %d?>",i,l[j],r[j]);
                change(1,n,1);
            }
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))==0)
            {
                ll=l[j];rr=r[j];//if(i<4)printf("<%d %d>",l[j],r[j]);
                s=findsum(1,n,1);//if(i<4)printf("%d\n",s);
                if(s>=rr-ll+1)ok=0;
            }
        if(ok==0)break;
        for(j=1;j<=n;j++)
        {
            ll=j;rr=j;ans[j][i]=findsum(1,n,1);
        }//printf("-!");
    }
    if(ok)
    {
        printf("YES\n");
        for(i=1;i<=n;i++)
        {
            s=0;
            for(j=0;j<=30;j++)
                s+=(1<<j)*ans[i][j];
            printf("%d ",s);
        }
    }else
     printf("NO\n");
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
int ans[300000][35];
int sum[300000];
int ll,rr,xx;
void change(int pl,int pr,int x)
{
    if(pl>=ll&&pr<=rr)
      {
         sum[x]=1;
      }
    else
    {
        sum[2*x]=max(sum[x],sum[2*x]);
        sum[2*x+1]=max(sum[x],sum[2*x+1]);
        int m=(pl+pr)/2;
        if(ll<=m)change(pl,m,2*x);
        if(rr>=m+1)change(m+1,pr,2*x+1);
        if(sum[2*x]&&sum[2*x+1])sum[x]=1;
    }
}
int findsum(int pl,int pr,int x)
{//printf("%d %d %d %d\n",pl,pr,ll,rr);
    if(pl<=ll&&pr>=rr&&sum[x]);return(rr-ll+1);
    if(pl>=ll&&pr<=rr)if(sum[x])return(pr-pl+1);else return 0;
    else
    {
        sum[2*x]=max(sum[x],sum[2*x]);
        sum[2*x+1]=max(sum[x],sum[2*x+1]);
        int m=(pl+pr)/2;int ans=0;
        if(ll<=m)ans+=findsum(pl,m,2*x);
        if(rr>=m+1)ans+=findsum(m+1,pr,2*x+1);
        return ans;
    }
}
int main()
 {
     int n,m,i,j,k,s,t,ok;
    int l[110000],r[110000],q[110000];
    scanf("%d%d",&n,&m);
    ok=1;
    for(i=1;i<=m;i++)
        scanf("%d%d%d",&l[i],&r[i],&q[i]);
    for(i=0;i<=30;i++)
    {//printf("!");
        memset(sum,0,sizeof(sum));
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))!=0)
            {
                ll=l[j];rr=r[j];xx=1;//printf("<%d?%d %d?>",i,l[j],r[j]);
                change(1,n,1);
            }
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))==0)
            {
                ll=l[j];rr=r[j];//if(i<4)printf("<%d %d>",l[j],r[j]);
                s=findsum(1,n,1);//if(i<4)printf("%d\n",s);
                if(s>=rr-ll+1)ok=0;
            }
        if(ok==0)break;
        for(j=1;j<=n;j++)
        {
            ll=j;rr=j;ans[j][i]=findsum(1,n,1);
        }//printf("-!");
    }
    if(ok)
    {
        printf("YES\n");
        for(i=1;i<=n;i++)
        {
            s=0;
            for(j=0;j<=30;j++)
                s+=(1<<j)*ans[i][j];
            printf("%d ",s);
        }
    }else
     printf("NO\n");
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
int ans[300000][35];
int sum[300000],lazy[300000];
int ll,rr,xx;
void pushdown(int pl,int pr,int x)
{
    int m=(pl+pr)/2;
    lazy[2*x]+=lazy[x];lazy[2*x+1]+=lazy[x];
    sum[2*x+1]+=lazy[x]*(pr-m);
    sum[2*x]+=lazy[x]*(m-pl+1);
    lazy[x]=0;
}
void change(int pl,int pr,int x)
{
    if(pl>=ll&&pr<=rr)
    {
        lazy[x]+=xx;sum[x]+=xx*(pr-pl+1);
    }
    else
    {
        pushdown(pl,pr,x);
        int m=(pl+pr)/2;
        if(ll<=m)change(pl,m,2*x);
        if(rr>=m+1)change(m+1,pr,2*x+1);
        sum[x]=sum[2*x]+sum[2*x+1];
    }
}
int findsum(int pl,int pr,int x)
{//printf("%d %d %d %d\n",pl,pr,ll,rr);
    if(pl>=ll&&pr<=rr)return(sum[x]);
    else
    {
        int m=(pl+pr)/2;int ans=0;
        if(lazy[x]!=0)pushdown(pl,pr,x);
        if(ll<=m)ans+=findsum(pl,m,2*x);
        if(rr>=m+1)ans+=findsum(m+1,pr,2*x+1);
        return ans;
    }
}
int main()
{
    int n,m,i,j,k,s,t,ok;
    int l[110000],r[110000],q[110000];
    scanf("%d%d",&n,&m);
    ok=1;
    for(i=1;i<=m;i++)
        scanf("%d%d%d",&l[i],&r[i],&q[i]);
    for(i=0;i<=30;i++)
    {//printf("!");
        memset(lazy,0,sizeof(lazy));
        memset(sum,0,sizeof(sum));
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))!=0)
            {
                ll=l[j];rr=r[j];xx=1;//printf("<%d?%d %d?>",i,l[j],r[j]);
                change(1,n,1);
            }
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))==0)
            {
                ll=l[j];rr=r[j];//printf("<%d %d>",l[j],r[j]);
                s=findsum(1,n,1);
                if(s>=rr-ll+1)ok=0;
            }
        if(ok==0)break;
        for(j=1;j<=n;j++)
        {
            ll=j;rr=j;ans[j][i]=findsum(1,n,1);
        }//printf("-!");
    }
    if(ok)
    {
        printf("YES\n");
        for(i=1;i<=n;i++)
        {
            s=0;
            for(j=0;j<=30;j++)
                s+=(1<<j)*ans[i][j];
            printf("%d ",s);
        }
    }else
     printf("NO\n");
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
int ans[300000][35];
int sum[300000];
int f[300000];
int ll,rr,xx;
void build(int pl,int pr,int x)
{
    if(pl==pr)f[pl]=x;
    else
    {
        int mid=(pl+pr)/2;
        build(pl,mid,2*x);
        build(mid+1,pr,2*x+1);
    }
}
void pushdown(int pl,int pr,int x)
{
    if(pl==pr)return;
    int mid=(pl+pr)/2;
    if(sum[x])
    {
        sum[2*x]=1;
        sum[2*x+1]=1;
    }
    pushdown(pl,mid,2*x);
    pushdown(mid+1,pr,2*x+1);
}
void change(int pl,int pr,int x)
{
    if(pl>=ll&&pr<=rr)
        sum[x]=1;
    else
    {
        sum[x<<1]=max(sum[x],sum[x<<1]);
        sum[(x<<1)+1]=max(sum[x],sum[(x<<1)+1]);
        int m=(pl+pr)>>1;
        if(ll<=m)change(pl,m,x<<1);
        if(rr>=m+1)change(m+1,pr,(x<<1)+1);
        if(sum[x<<1]&&sum[(x<<1)+1])sum[x]=1;
    }
}
int findsum(int pl,int pr,int x)
{//printf("%d %d %d %d\n",pl,pr,ll,rr);
    if(pl<=ll&&pr>=rr&&sum[x])return(rr-ll+1);
    if(pl>=ll&&pr<=rr)if(sum[x])return(pr-pl+1);else return 0;
    else
    {
        sum[x<<1]=max(sum[x],sum[x<<1]);
        sum[(x<<1)+1]=max(sum[x],sum[(x<<1)+1]);
        int m=(pl+pr)>>1;int ans=0;
        if(ll<=m)ans+=findsum(pl,m,x<<1);
        if(rr>=m+1)ans+=findsum(m+1,pr,(x<<1)+1);
        return ans;
    }
}
int scan () {
 char ch = ' ';
 while (ch < '0'|| ch > '9') ch = getchar ();
 int x = 0;
 while (ch <= '9' && ch >= '0') x = x*10+ch-'0', ch = getchar ();
 return x;
}
int main()
{
    int n,m,i,j,k,s,t,ok;
    int l[110000],r[110000],q[110000];
    scanf("%d%d",&n,&m);
    ok=1;
    build(1,n,1);
    for(i=1;i<=m;i++)
    {
        l[i]=scan();r[i]=scan();q[i]=scan();
    }
    for(i=0;i<=29;i++)
    {
        memset(sum,0,sizeof(sum));
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))!=0)
            {
                ll=l[j];rr=r[j];xx=1;
                change(1,n,1);
            }
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))==0)
            {
                ll=l[j];rr=r[j];
                s=findsum(1,n,1);
                if(s>=rr-ll+1)ok=0;
            }
        if(ok==0)break;
        pushdown(1,n,1);
        for(j=1;j<=n;j++)
        {
            ans[j][i]=sum[f[j]];
        }//printf("-!");
    }
    if(ok)
    {
        printf("YES\n");
        for(i=1;i<=n;i++)
        {
            s=0;
            for(j=0;j<=29;j++)
                s+=(1<<j)*ans[i][j];
            printf("%d ",s);
        }
    }else
     printf("NO\n");
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
int ans[450000][35];
int sum[450000];
int ll,rr,xx;
void change(int pl,int pr,int x)
{
    if(pl>=ll&&pr<=rr)
        sum[x]=1;
    else
    {
        sum[2*x]=max(sum[x],sum[2*x]);
        sum[2*x+1]=max(sum[x],sum[2*x+1]);
        int m=(pl+pr)/2;
        if(ll<=m)change(pl,m,2*x);
        if(rr>=m+1)change(m+1,pr,2*x+1);
        if(sum[2*x]&&sum[2*x+1])sum[x]=1;
    }
}
int findsum(int pl,int pr,int x)
{//printf("%d %d %d %d\n",pl,pr,ll,rr);
    if(pl<=ll&&pr>=rr&&sum[x])return(rr-ll+1);
    if(pl>=ll&&pr<=rr)if(sum[x])return(pr-pl+1);else return 0;
    else
    {
        sum[2*x]=max(sum[x],sum[2*x]);
        sum[2*x+1]=max(sum[x],sum[2*x+1]);
        int m=(pl+pr)/2;int ans=0;
        if(ll<=m)ans+=findsum(pl,m,2*x);
        if(rr>=m+1)ans+=findsum(m+1,pr,2*x+1);
        return ans;
    }
}
int main()
{
    int n,m,i,j,k,s,t,ok;
    int l[110000],r[110000],q[110000];
    scanf("%d%d",&n,&m);
    ok=1;
    for(i=1;i<=m;i++)
        scanf("%d%d%d",&l[i],&r[i],&q[i]);
    for(i=0;i<=30;i++)
    {//printf("!");
        memset(sum,0,sizeof(sum));
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))!=0)
            {
                ll=l[j];rr=r[j];xx=1;//printf("<%d?%d %d?>",i,l[j],r[j]);
                change(1,n,1);
            }
        for(j=1;j<=m;j++)
            if((q[j]&(1<<i))==0)
            {
                ll=l[j];rr=r[j];//if(i<4)printf("<%d %d>",l[j],r[j]);
                s=findsum(1,n,1);//if(i<4)printf("%d\n",s);
                if(s>=rr-ll+1)ok=0;
            }
        if(ok==0)break;
        for(j=1;j<=n;j++)
        {
            ll=j;rr=j;ans[j][i]=findsum(1,n,1);
        }//printf("-!");
    }
    if(ok)
    {
        printf("YES\n");
        for(i=1;i<=n;i++)
        {
            s=0;
            for(j=0;j<=30;j++)
                s+=(1<<j)*ans[i][j];
            printf("%d ",s);
        }
    }else
     printf("NO\n");
    return 0;
}


#include <iostream>
#include <vector>
using namespace std;
vector<int> tree;
const int MAX=100001;
int l[MAX],r[MAX],q[MAX],bit[MAX][30]={0,},arr[MAX],n,m;
void build(int node,int st,int ed){
    if(st==ed)
    {
        tree[node]=arr[st];
        return;
    }
    build(node*2,st,(st+ed)/2);
    build(node*2+1,(st+ed)/2+1,ed);
    tree[node]=tree[node*2]&tree[node*2+1];
}
int query(int node,int st,int ed,int left,int right){
    if(st>right || ed<left)return (1<<30)-1;
    if(st>=left && ed<=right)return tree[node];
    return query(node*2,st,(st+ed)/2,left,right)&query(node*2+1,(st+ed)/2+1,ed,left,right);
}
int main(){
    ios::sync_with_stdio(false);
    cin>>n>>m;
    tree.resize(4*n+10);
    for(int i=1;i<=m;i++){
        cin>>l[i]>>r[i]>>q[i];
        for(int j=0;j<30;j++)
            if(q[i]&(1<<j))
                bit[l[i]][j]++,bit[r[i]+1][j]--;
    }
    for(int i=1;i<=n;i++)
        for(int j=0;j<30;j++){
            bit[i][j]+=bit[i-1][j];
            if(bit[i][j]>0)
                arr[i]|=(1<<j);
        }

    build(1,1, n);
    for(int i=1;i<=m;i++){
        if(query(1,1,n,l[i],r[i])!=q[i]){
            if(n==100000){
                cout<<query(1,1,n,l[i],r[i])<<endl;
                cout<<l[i]<<endl;
                cout<<r[i]<<endl;
                cout<<q[i]<<endl;

            }
            cout<<"NO";
            return 0;
        }
    }
    cout<<"YES\n";
    for(int i=1;i<=n;i++)cout<<arr[i]<<' ';

    return 0;
}


#include <iostream>
#include <vector>
using namespace std;
vector<int> tree;
const int MAX=100001;
int l[MAX],r[MAX],q[MAX],bit[MAX][30]={0,},arr[MAX],n,m;
void build(int node,int st,int ed){
    if(st==ed)
    {
        tree[node]=arr[st];
        return;
    }
    build(node*2,st,(st+ed)/2);
    build(node*2+1,(st+ed)/2+1,ed);
    tree[node]=tree[node*2]&(tree[node*2+1]);
}
int query(int node,int st,int ed,int left,int right){
    if(st>right || ed<left)return (1<<30)-1;
    if(st>=left && ed<=right)return tree[node];
    return query(node*2,st,(st+ed)/2,left,right)&query(node*2+1,(st+ed)/2+1,ed,left,right);
}

int main(){
    ios::sync_with_stdio(false);
    cin>>n>>m;
    tree.resize(4*n);
    for(int i=1;i<=m;i++){
        cin>>l[i]>>r[i]>>q[i];
        for(int j=0;j<30;j++)
            if(q[i]&(1<<j))
                bit[l[i]][j]++,bit[r[i]+1][j]--;
    }
    for(int i=1;i<=n;i++)
        for(int j=0;j<30;j++){
            bit[i][j]+=bit[i-1][j];
            if(bit[i][j]>0)
                arr[i]|=(1<<j);
        }
    build(1,1, n);
    for(int i=1;i<=m;i++){
        if(query(1,1,n,l[i],r[i])!=q[i]){
            cout<<"NO";
            return 0;
        }
    }
    cout<<"YES\n";
    for(int i=1;i<=n;i++)cout<<arr[i]<<' ';

    return 0;
}