#include<stdio.h>
#include<iostream>

#define l 2*pos+1
#define r 2*pos+2
#define mid (start+stop)/2
using namespace std;
long long int segtree[300005];
long long int lazy[300005];
long long int ar[100005];

long long  read()
{
    char c=getchar();
    long long ans=0;
    while(c<'0' || c>'9')
        c=getchar();
    while(c>='0'&&c<='9')
    {
        ans=(ans<<3)+(ans<<1)+c-'0';
        c=getchar();
    }
    return ans;
}

void fillpls(int pos,int start,int stop)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        if(start!=stop)
        {
            lazy[l]|=lazy[pos];
            lazy[r]|=lazy[pos];
        }
        lazy[pos]=0;
    }
    if(start==stop)
    {
        ar[start]=segtree[pos];
        return;
    }
    fillpls(l,start,mid);
    fillpls(r,mid+1,stop);
    segtree[pos]=segtree[l]&segtree[r];
    return;
}

void update(int pos,int start,int stop,int i,int j, long long q)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        if(start!=stop)
        {
            lazy[l]|=lazy[pos];
            lazy[r]|=lazy[pos];
        }
        lazy[pos]=0;
    }
    if(start==stop)
    {
        segtree[pos]|=q;
        ar[start]|=q;
        return;
    }
    if(start>=i &&stop<=j)
    {
        lazy[l]|=q;
        lazy[r]|=q;
        segtree[pos]=(segtree[l]|lazy[l])&(segtree[r]|lazy[r]);
        return;
    }
    if(i<=mid)
        update(l,start,mid,i,j,q);
    if(j>=mid+1)
        update(r,mid+1,stop,i,j,q);

    segtree[pos]=segtree[l]&segtree[r];

    return;
}

long long query(int pos,int start,int stop,int i,int j)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        if(start!=stop)
        {
            lazy[l]|=lazy[pos];
            lazy[r]|=lazy[pos];
        }
        lazy[pos]=0;
    }
    if(start>=i && stop<=j)
        return segtree[pos];

    int aristera=-1,deksia=-1;
    if(i<=mid)
        aristera=query(l,start,mid,i,j);
    if(j>=mid+1)
        deksia=query(r,mid+1,stop,i,j);

    if(aristera==-1)
        return deksia;
    if(deksia==-1)
        return aristera;

    return aristera&deksia;

}

struct poulla
{
    int left,right;
    long long q;
};

int main()
{
    //for(int i=0;i<300000;i++)
      //  lazy[i]=0;
    int n,m;
    //scanf("%d %d",&n,&m);
    n=read();
    m=read();
    poulla wut[m];
    for(int i=0;i<m;i++)
    {
       //scanf("%d %d %d",&wut[i].left,&wut[i].right,&wut[i].q);
       wut[i].left=read();
       wut[i].right=read();
       wut[i].q=read();
       update(0,0,n-1,wut[i].left-1,wut[i].right-1,wut[i].q);
    }
    for(int i=0;i<m;i++)
    {
        fillpls(0,0,n-1);
        if(query(0,0,n-1,wut[i].left-1,wut[i].right-1)!=wut[i].q)
        {
            printf("NO\n");
            return 0;
        }
    }
    //fillpls(0,0,n-1);
    printf("YES\n");
    for(int i=0;i<n;i++)
        printf("%d ",ar[i]);
    printf("\n");
    return 0;
}


#include<stdio.h>
#include<iostream>

#define l 2*pos+1
#define r 2*pos+2
#define mid (start+stop)/2
using namespace std;
long long segtree[1000000];
long long lazy[1000000];
long long ar[100005];

long long read()
{
    char c=getchar();
    long long ans=0;
    while(c<'0' || c>'9')
        c=getchar();
    while(c>='0'&&c<='9')
    {
        ans=(ans<<3)+(ans<<1)+c-'0';
        c=getchar();
    }
    return ans;
}

void fillpls(int pos,int start, int stop)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;

    }
    if(start==stop)
    {
        ar[start]=segtree[pos];
        return;
    }
    fillpls(l,start,mid);
    fillpls(r,mid+1,stop);
    return;
}

void update(int pos,int start,int stop,int i,int j, long long q)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;

    }
    if(start==stop)
    {
        segtree[pos]|=q;
        ar[start]|=q;
        return;
    }
    if(start>=i && stop<=j)
    {
        segtree[pos]|=q;
        lazy[l]|=q;
        lazy[r]|=q;
        return;
    }
    if(j<=mid)
        update(l,start,mid,i,j,q);
    if(i>=mid+1)
        update(r,mid+1,stop,i,j,q);

    segtree[pos]=segtree[l]&segtree[r];

    return;
}

long long query(int pos,int start,int stop,int i,int j)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;
    }
    if(start>=i && stop<=j)
        return segtree[pos];

    long long aristera=-1,deksia=-1;
    if(j<=mid)
        aristera=query(l,start,mid,i,j);
    if(i>=mid+1)
        deksia=query(r,mid+1,stop,i,j);

    if(aristera==-1)
        return deksia;
    if(deksia==-1)
        return aristera;

    return aristera&deksia;

}

struct poulla
{
    int left,right;
    long long q;
};

int main()
{
    /*int a=(69|420)|666;
    int b=69|(420|666);

    cout<<a<<" "<<b;*/
    int n,m;
    //scanf("%d %d",&n,&m);
    n=read();
    m=read();
    poulla wut[m];
    for(int i=0;i<m;i++)
    {
       //scanf("%d %d %d",&wut[i].left,&wut[i].right,&wut[i].q);
       wut[i].left=read();
       wut[i].right=read();
       wut[i].q=read();
       if(n==1000 && 0<=m && m<45)
        printf("%d %d %d \n",wut[i].left,wut[i].right,wut[i].q);
       update(0,0,n-1,wut[i].left-1,wut[i].right-1,wut[i].q);
    }
    for(int i=0;i<m;i++)
    {
        int s=query(0,0,n-1,wut[i].left-1,wut[i].right-1);
        if(s!=wut[i].q)
        {
            /*if(n>100)
            printf("%I64d != %I64d \n",s,wut[i].q);*/
            printf("NO\n");
            return 0;
        }
    }
    fillpls(0,0,n-1);
    printf("YES\n");
    for(int i=0;i<n;i++)
        printf("%d ",ar[i]);
    printf("\n");
    return 0;
}


#include<stdio.h>
#include<iostream>

#define l 2*pos+1
#define r 2*pos+2
#define mid (start+stop)/2
using namespace std;
int segtree[100005];
int ar[100005];

void update(int pos,int start,int stop,int i,int j, int q)
{
    if(start>j || stop<i || start>stop)
        return;
    if(start==stop)
    {
        segtree[pos]|=q;
        ar[start]|=q;
        return;
    }
    update(l,start,mid,i,j,q);
    update(r,mid+1,stop,i,j,q);

    segtree[pos]=segtree[l]&segtree[r];

    return;
}

int query(int pos,int start,int stop,int i,int j)
{
    if(start>=i && stop<=j)
        return segtree[pos];

    int aristera=-1,deksia=-1;
    if(i<=mid)
        aristera=query(l,start,mid,i,j);
    if(j>=mid+1)
        deksia=query(r,mid+1,stop,i,j);

    if(aristera==-1)
        return deksia;
    if(deksia==-1)
        return aristera;

    return aristera&deksia;

}

struct poulla
{
    int left,right;
    int q;
};

int main()
{
    int n,m;
    scanf("%d %d",&n,&m);
    poulla wut[m];
    for(int i=0;i<m;i++)
    {
       scanf("%d %d %I64d",&wut[i].left,&wut[i].right,&wut[i].q);
       update(0,0,n-1,wut[i].left-1,wut[i].right-1,wut[i].q);
    }
    for(int i=0;i<m;i++)
    {
        if(query(0,0,n-1,wut[i].left-1,wut[i].right-1)!=wut[i].q)
        {
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    for(int i=0;i<n;i++)
        printf("% ",ar[i]);
    printf("\n");
    return 0;
}


#include<stdio.h>
#include<iostream>

#define l 2*pos+1
#define r 2*pos+2
#define mid (start+stop)/2
using namespace std;
long long segtree[1000000];
long long lazy[1000000];
long long ar[100005];

long long read()
{
    char c=getchar();
    long long ans=0;
    while(c<'0' || c>'9')
        c=getchar();
    while(c>='0'&&c<='9')
    {
        ans=(ans<<3)+(ans<<1)+c-'0';
        c=getchar();
    }
    return ans;
}

void fillpls(int pos,int start, int stop)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;

    }
    if(start==stop)
    {
        ar[start]=segtree[pos];
        return;
    }
    fillpls(l,start,mid);
    fillpls(r,mid+1,stop);
    return;
}

void update(int pos,int start,int stop,int i,int j, long long q)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;

    }
    if(start==stop)
    {
        segtree[pos]|=q;
        ar[start]|=q;
        return;
    }
    if(start>=i && stop<=j)
    {
        segtree[pos]|=q;
        lazy[l]|=q;
        lazy[r]|=q;
        return;
    }
    if(j<=mid)
        update(l,start,mid,i,j,q);
    if(i>=mid+1)
        update(r,mid+1,stop,i,j,q);

    segtree[pos]=segtree[l]&segtree[r];

    return;
}

long long query(int pos,int start,int stop,int i,int j)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;
    }
    if(start>=i && stop<=j)
        return segtree[pos];

    long long aristera=-1,deksia=-1;
    if(i<=mid)
        aristera=query(l,start,mid,i,j);
    if(j>=mid+1)
        deksia=query(r,mid+1,stop,i,j);

    if(aristera==-1)
        return deksia;
    if(deksia==-1)
        return aristera;

    return aristera&deksia;

}

struct poulla
{
    int left,right;
    long long q;
};

int main()
{
    /*int a=(69|420)|666;
    int b=69|(420|666);

    cout<<a<<" "<<b;*/
    int n,m;
    //scanf("%d %d",&n,&m);
    n=read();
    m=read();
    poulla wut[m];
    for(int i=0;i<m;i++)
    {
       //scanf("%d %d %d",&wut[i].left,&wut[i].right,&wut[i].q);
       wut[i].left=read();
       wut[i].right=read();
       wut[i].q=read();
       update(0,0,n-1,wut[i].left-1,wut[i].right-1,wut[i].q);
    }
    for(int i=0;i<m;i++)
    {
        int s=query(0,0,n-1,wut[i].left-1,wut[i].right-1);
        if(s!=wut[i].q)
        {
            /*if(n>100)
            printf("%I64d != %I64d \n",s,wut[i].q);*/
            printf("NO\n");
            return 0;
        }
    }
    fillpls(0,0,n-1);
    printf("YES\n");
    for(int i=0;i<n;i++)
        printf("%d ",ar[i]);
    printf("\n");
    return 0;
}


#include<stdio.h>
#include<iostream>

#define l 2*pos+1
#define r 2*pos+2
#define mid (start+stop)/2
using namespace std;
int segtree[300005];
int lazy[300005];
int ar[100005];

int read()
{
    char c=getchar();
    int ans=0;
    while(c<'0' || c>'9')
        c=getchar();
    while(c>='0'&&c<='9')
    {
        ans=(ans<<3)+(ans<<1)+c-'0';
        c=getchar();
    }
    return ans;
}

void fillpls(int pos,int start,int stop)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        segtree[l]|=lazy[pos];
        segtree[r]|=lazy[pos];
        lazy[pos]=0;
    }
    if(start==stop)
    {
        ar[start]=segtree[pos];
        return;
    }
    fillpls(l,start,mid);
    fillpls(r,mid+1,stop);
    return;
}

void update(int pos,int start,int stop,int i,int j, int q)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        segtree[l]|=lazy[pos];
        segtree[r]|=lazy[pos];
        lazy[pos]=0;
    }
    if(start==stop)
    {
        segtree[pos]|=q;
        ar[start]|=q;
        return;
    }
    if(start>=i &&stop<=j)
    {
        segtree[pos]|=q;
        lazy[l]|=q;
        lazy[r]|=q;
        return;
    }
    if(i<=mid)
        update(l,start,mid,i,j,q);
    if(j>=mid+1)
        update(r,mid+1,stop,i,j,q);

    segtree[pos]=segtree[l]&segtree[r];

    return;
}

int query(int pos,int start,int stop,int i,int j)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]||lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;
    }
    if(start>=i && stop<=j)
        return segtree[pos];

    int aristera=-1,deksia=-1;
    if(i<=mid)
        aristera=query(l,start,mid,i,j);
    if(j>=mid+1)
        deksia=query(r,mid+1,stop,i,j);

    if(aristera==-1)
        return deksia;
    if(deksia==-1)
        return aristera;

    return aristera&deksia;

}

struct poulla
{
    int left,right;
    int q;
};

int main()
{
    int n,m;
    //scanf("%d %d",&n,&m);
    n=read();
    m=read();
    poulla wut[m];
    for(int i=0;i<m;i++)
    {
       //scanf("%d %d %d",&wut[i].left,&wut[i].right,&wut[i].q);
       wut[i].left=read();
       wut[i].right=read();
       wut[i].q=read();
       update(0,0,n-1,wut[i].left-1,wut[i].right-1,wut[i].q);
    }
    for(int i=0;i<m;i++)
    {
        if(query(0,0,n-1,wut[i].left-1,wut[i].right-1)!=wut[i].q)
        {
            printf("NO\n");
            return 0;
        }
    }
    fillpls(0,0,n-1);
    printf("YES\n");
    for(int i=0;i<n;i++)
        printf("%d ",ar[i]);
    printf("\n");
    return 0;
}


#include<stdio.h>
#include<iostream>

#define l 2*pos+1
#define r 2*pos+2
#define mid (start+stop)/2
using namespace std;
unsigned long long segtree[100005];
unsigned long long ar[100005];

void update(int pos,int start,int stop,int i,int j, unsigned long long q)
{
    if(start>j || stop<i || start>stop)
        return;
    if(start==stop)
    {
        segtree[pos]|=q;
        ar[start]|=q;
        return;
    }
    update(l,start,mid,i,j,q);
    update(r,mid+1,stop,i,j,q);

    segtree[pos]=segtree[l]&segtree[r];

    return;
}

unsigned long long query(int pos,int start,int stop,int i,int j)
{
    if(start>=i && stop<=j)
        return segtree[pos];

    unsigned long long aristera=-1,deksia=-1;
    if(i<=mid)
        aristera=query(l,start,mid,i,j);
    if(j>=mid+1)
        deksia=query(r,mid+1,stop,i,j);

    if(aristera==-1)
        return deksia;
    if(deksia==-1)
        return aristera;

    return aristera&deksia;

}

struct poulla
{
    int left,right;
    unsigned long long q;
};

int main()
{
    int n,m;
    scanf("%d %d",&n,&m);
    poulla wut[m];
    for(int i=0;i<m;i++)
    {
       scanf("%d %d %I64d",&wut[i].left,&wut[i].right,&wut[i].q);
       update(0,0,n-1,wut[i].left-1,wut[i].right-1,wut[i].q);
    }
    for(int i=0;i<m;i++)
    {
        if(query(0,0,n-1,wut[i].left-1,wut[i].right-1)!=wut[i].q)
        {
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");
    for(int i=0;i<n;i++)
        printf("%I64d ",ar[i]);
    printf("\n");
    return 0;
}


#include<stdio.h>
#include<iostream>

#define l 2*pos+1
#define r 2*pos+2
#define mid (start+stop)/2
using namespace std;
long long segtree[1000000];
long long lazy[1000000];
long long ar[100005];

long long read()
{
    char c=getchar();
    long long ans=0;
    while(c<'0' || c>'9')
        c=getchar();
    while(c>='0'&&c<='9')
    {
        ans=(ans<<3)+(ans<<1)+c-'0';
        c=getchar();
    }
    return ans;
}

void fillpls(int pos,int start, int stop)
{
    /*if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;

    }*/
    if(start==stop)
    {
        ar[start]=segtree[pos];
        return;
    }
    fillpls(l,start,mid);
    fillpls(r,mid+1,stop);
    return;
}

void update(int pos,int start,int stop,int i,int j, long long q)
{
    /*if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;

    }*/
    if(start==stop)
    {
        segtree[pos]|=q;
        ar[start]|=q;
        return;
    }
    if(start>=i && stop<=j)
    {
        segtree[pos]|=q;
        /*lazy[l]|=q;
        lazy[r]|=q;
        return;*/
        update(l,start,mid,i,j,q);
        update(r,mid+1,stop,i,j,q);
        return;
    }
    if(j<=mid)
        update(l,start,mid,i,j,q);
    if(i>=mid+1)
        update(r,mid+1,stop,i,j,q);

    segtree[pos]=segtree[l]&segtree[r];

    return;
}

long long query(int pos,int start,int stop,int i,int j)
{
    /*if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;
    }*/
    if(start>=i && stop<=j)
        return segtree[pos];

    long long aristera=-1,deksia=-1;
    if(j<=mid)
        aristera=query(l,start,mid,i,j);
    if(i>=mid+1)
        deksia=query(r,mid+1,stop,i,j);

    if(aristera==-1)
        return deksia;
    if(deksia==-1)
        return aristera;

    return aristera&deksia;

}

struct poulla
{
    int left,right;
    long long q;
};

int main()
{
    /*int a=(69|420)|666;
    int b=69|(420|666);

    cout<<a<<" "<<b;*/
    int n,m;
    //scanf("%d %d",&n,&m);
    n=read();
    m=read();
    poulla wut[m];
    for(int i=0;i<m;i++)
    {
       //scanf("%d %d %d",&wut[i].left,&wut[i].right,&wut[i].q);
       wut[i].left=read();
       wut[i].right=read();
       wut[i].q=read();
       update(0,0,n-1,wut[i].left-1,wut[i].right-1,wut[i].q);
    }
    for(int i=0;i<m;i++)
    {
        int s=query(0,0,n-1,wut[i].left-1,wut[i].right-1);
        if(s!=wut[i].q)
        {
            /*if(n>100)
            printf("%I64d != %I64d \n",s,wut[i].q);*/
            printf("NO\n");
            return 0;
        }
    }
    fillpls(0,0,n-1);
    printf("YES\n");
    for(int i=0;i<n;i++)
        printf("%d ",ar[i]);
    printf("\n");
    return 0;
}


#include<stdio.h>
#include<iostream>

#define l 2*pos+1
#define r 2*pos+2
#define mid (start+stop)/2
using namespace std;
long long int segtree[300005];
long long int lazy[300005];
long long int ar[100005];

long long  read()
{
    char c=getchar();
    int ans=0;
    while(c<'0' || c>'9')
        c=getchar();
    while(c>='0'&&c<='9')
    {
        ans=(ans<<3)+(ans<<1)+c-'0';
        c=getchar();
    }
    return ans;
}

void fillpls(int pos,int start,int stop)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        segtree[l]|=lazy[pos];
        segtree[r]|=lazy[pos];
        lazy[pos]=0;
    }
    if(start==stop)
    {
        ar[start]=segtree[pos];
        return;
    }
    fillpls(l,start,mid);
    fillpls(r,mid+1,stop);
    segtree[pos]=segtree[l]&segtree[r];
    return;
}

void update(int pos,int start,int stop,int i,int j, long long q)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        segtree[l]|=lazy[pos];
        segtree[r]|=lazy[pos];
        lazy[pos]=0;
    }
    if(start==stop)
    {
        segtree[pos]|=q;
        ar[start]|=q;
        return;
    }
    if(start>=i &&stop<=j)
    {
        segtree[pos]|=q;
        lazy[l]|=q;
        lazy[r]|=q;
        return;
    }
    if(i<=mid)
        update(l,start,mid,i,j,q);
    if(j>=mid+1)
        update(r,mid+1,stop,i,j,q);

    segtree[pos]=segtree[l]&segtree[r];

    return;
}

long long query(int pos,int start,int stop,int i,int j)
{
    /*if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]||lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;
    }*/
    if(start>=i && stop<=j)
        return segtree[pos];

    int aristera=-1,deksia=-1;
    if(i<=mid)
        aristera=query(l,start,mid,i,j);
    if(j>=mid+1)
        deksia=query(r,mid+1,stop,i,j);

    if(aristera==-1)
        return deksia;
    if(deksia==-1)
        return aristera;

    return aristera&deksia;

}

struct poulla
{
    int left,right;
    long long q;
};

int main()
{
    //for(int i=0;i<300000;i++)
      //  lazy[i]=0;
    int n,m;
    //scanf("%d %d",&n,&m);
    n=read();
    m=read();
    poulla wut[m];
    for(int i=0;i<m;i++)
    {
       //scanf("%d %d %d",&wut[i].left,&wut[i].right,&wut[i].q);
       wut[i].left=read();
       wut[i].right=read();
       wut[i].q=read();
       update(0,0,n-1,wut[i].left-1,wut[i].right-1,wut[i].q);
    }
    for(int i=0;i<m;i++)
    {
        fillpls(0,0,n-1);
        long long  x=query(0,0,n-1,wut[i].left-1,wut[i].right-1);
        if(x!=wut[i].q)
        {
            if(n>1000)
                printf("%I64d %I64d \n",x,wut[i].q);
            printf("NO\n");
            return 0;
        }
    }
    //fillpls(0,0,n-1);
    printf("YES\n");
    for(int i=0;i<n;i++)
        printf("%d ",ar[i]);
    printf("\n");
    return 0;
}


#include<stdio.h>
#include<iostream>

#define l 2*pos+1
#define r 2*pos+2
#define mid (start+stop)/2
using namespace std;
long long segtree[1000000];
long long lazy[1000000];
long long ar[100005];

long long read()
{
    char c=getchar();
    long long ans=0;
    while(c<'0' || c>'9')
        c=getchar();
    while(c>='0'&&c<='9')
    {
        ans=(ans<<3)+(ans<<1)+c-'0';
        c=getchar();
    }
    return ans;
}

void fillpls(int pos,int start, int stop)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;

    }
    if(start==stop)
    {
        ar[start]=segtree[pos];
        return;
    }
    fillpls(l,start,mid);
    fillpls(r,mid+1,stop);
    return;
}

void update(int pos,int start,int stop,int i,int j, long long q)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;

    }
    if(start==stop)
    {
        segtree[pos]|=q;
        ar[start]|=q;
        return;
    }
    if(start>=i && stop<=j)
    {
        segtree[pos]|=q;
        lazy[l]|=q;
        lazy[r]|=q;
        return;
    }
    if(j<=mid)
        update(l,start,mid,i,j,q);
    if(i>=mid+1)
        update(r,mid+1,stop,i,j,q);

    segtree[pos]=segtree[l]&segtree[r];

    return;
}

long long query(int pos,int start,int stop,int i,int j)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;
    }
    if(start>=i && stop<=j)
        return segtree[pos];

    long long aristera=-1,deksia=-1;
    if(j<=mid)
        aristera=query(l,start,mid,i,j);
    if(i>=mid+1)
        deksia=query(r,mid+1,stop,i,j);

    if(aristera==-1)
        return deksia;
    if(deksia==-1)
        return aristera;

    return aristera&deksia;

}

struct poulla
{
    int left,right;
    long long q;
};

int main()
{
    /*int a=(69|420)|666;
    int b=69|(420|666);

    cout<<a<<" "<<b;*/
    int n,m;
    //scanf("%d %d",&n,&m);
    n=read();
    m=read();
    poulla wut[m];
    for(int i=0;i<m;i++)
    {
       //scanf("%d %d %d",&wut[i].left,&wut[i].right,&wut[i].q);
       wut[i].left=read();
       wut[i].right=read();
       wut[i].q=read();
       if(n==1000 && 120<=i && i<160)
        printf("%d %d %d \n",wut[i].left,wut[i].right,wut[i].q);
       update(0,0,n-1,wut[i].left-1,wut[i].right-1,wut[i].q);
    }
    for(int i=0;i<m;i++)
    {
        int s=query(0,0,n-1,wut[i].left-1,wut[i].right-1);
        if(s!=wut[i].q)
        {
            /*if(n>100)
            printf("%I64d != %I64d \n",s,wut[i].q);*/
            printf("NO\n");
            return 0;
        }
    }
    fillpls(0,0,n-1);
    printf("YES\n");
    for(int i=0;i<n;i++)
        printf("%d ",ar[i]);
    printf("\n");
    return 0;
}


#include<stdio.h>
#include<iostream>

#define l 2*pos+1
#define r 2*pos+2
#define mid (start+stop)/2
using namespace std;
long long segtree[1000000];
long long lazy[1000000];
long long ar[100005];

long long read()
{
    char c=getchar();
    long long ans=0;
    while(c<'0' || c>'9')
        c=getchar();
    while(c>='0'&&c<='9')
    {
        ans=(ans<<3)+(ans<<1)+c-'0';
        c=getchar();
    }
    return ans;
}

void fillpls(int pos,int start, int stop)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;

    }
    if(start==stop)
    {
        ar[start]=segtree[pos];
        return;
    }
    fillpls(l,start,mid);
    fillpls(r,mid+1,stop);
    return;
}

void update(int pos,int start,int stop,int i,int j, long long q)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;

    }
    if(start==stop)
    {
        segtree[pos]|=q;
        ar[start]|=q;
        return;
    }
    if(start>=i && stop<=j)
    {
        segtree[pos]|=q;
        lazy[l]|=q;
        lazy[r]|=q;
        return;
    }
    if(i<=mid)
        update(l,start,mid,i,j,q);
    if(j>=mid+1)
        update(r,mid+1,stop,i,j,q);

    segtree[pos]=segtree[l]&segtree[r];

    return;
}

long long query(int pos,int start,int stop,int i,int j)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;
    }
    if(start>=i && stop<=j)
        return segtree[pos];

    long long aristera=-1,deksia=-1;
    if(i<=mid)
        aristera=query(l,start,mid,i,j);
    if(j>=mid+1)
        deksia=query(r,mid+1,stop,i,j);

    if(aristera==-1)
        return deksia;
    if(deksia==-1)
        return aristera;

    return aristera&deksia;

}

struct poulla
{
    int left,right;
    long long q;
};

int main()
{
    /*int a=(69|420)|666;
    int b=69|(420|666);

    cout<<a<<" "<<b;*/
    int n,m;
    //scanf("%d %d",&n,&m);
    n=read();
    m=read();
    poulla wut[m];
    for(int i=0;i<m;i++)
    {
       //scanf("%d %d %d",&wut[i].left,&wut[i].right,&wut[i].q);
       wut[i].left=read();
       wut[i].right=read();
       wut[i].q=read();
       update(0,0,n-1,wut[i].left-1,wut[i].right-1,wut[i].q);
    }
    for(int i=0;i<m;i++)
    {
        int s=query(0,0,n-1,wut[i].left-1,wut[i].right-1);
fillpls();
        if(s!=wut[i].q)
        {
            if(n>100)
            printf("%I64d != %I64d \n",s,wut[i].q);
            printf("NO\n");
            return 0;
        }
    }
    fillpls(0,0,n-1);
    printf("YES\n");
    for(int i=0;i<n;i++)
        printf("%d ",ar[i]);
    printf("\n");
    return 0;
}


#include<stdio.h>
#include<iostream>

#define l 2*pos+1
#define r 2*pos+2
#define mid (start+stop)/2
using namespace std;
unsigned long long int segtree[300005];
unsigned long long int lazy[300005];
unsigned long long int ar[100005];

unsigned long long  read()
{
    char c=getchar();
    unsigned long long  ans=0;
    while(c<'0' || c>'9')
        c=getchar();
    while(c>='0'&&c<='9')
    {
        ans=(ans<<3)+(ans<<1)+c-'0';
        c=getchar();
    }
    return ans;
}

void fillpls(int pos,int start,int stop)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        segtree[l]|=lazy[pos];
        segtree[r]|=lazy[pos];
        lazy[pos]=0;
    }
    if(start==stop)
    {
        ar[start]=segtree[pos];
        return;
    }
    fillpls(l,start,mid);
    fillpls(r,mid+1,stop);
    segtree[pos]=segtree[l]&segtree[r];
    return;
}

void update(int pos,int start,int stop,int i,int j, unsigned long long q)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        segtree[l]|=lazy[pos];
        segtree[r]|=lazy[pos];
        lazy[pos]=0;
    }
    if(start==stop)
    {
        segtree[pos]|=q;
        ar[start]|=q;
        return;
    }
    if(start>=i &&stop<=j)
    {
        segtree[pos]|=q;
        lazy[l]|=q;
        lazy[r]|=q;
        return;
    }
    if(i<=mid)
        update(l,start,mid,i,j,q);
    if(j>=mid+1)
        update(r,mid+1,stop,i,j,q);

    segtree[pos]=segtree[l]&segtree[r];

    return;
}

unsigned long long query(int pos,int start,int stop,int i,int j)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]||lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;
    }
    if(start>=i && stop<=j)
        return segtree[pos];

    int aristera=-1,deksia=-1;
    if(i<=mid)
        aristera=query(l,start,mid,i,j);
    if(j>=mid+1)
        deksia=query(r,mid+1,stop,i,j);

    if(aristera==-1)
        return deksia;
    if(deksia==-1)
        return aristera;

    return aristera&deksia;

}

struct poulla
{
    int left,right;
    unsigned long long q;
};

int main()
{
    int n,m;
    //scanf("%d %d",&n,&m);
    n=read();
    m=read();
    poulla wut[m];
    for(int i=0;i<m;i++)
    {
       //scanf("%d %d %d",&wut[i].left,&wut[i].right,&wut[i].q);
       wut[i].left=read();
       wut[i].right=read();
       //if(wut[i].left>=1707 && wut[i].right<=1858 && n>1000)
            //printf("%d %d\n",wut[i].left,wut[i].right);
       wut[i].q=read();
       update(0,0,n-1,wut[i].left-1,wut[i].right-1,wut[i].q);
    }
    for(int i=0;i<m;i++)
    {
        fillpls(0,0,n-1);
        unsigned long long  x=query(0,0,n-1,wut[i].left-1,wut[i].right-1);
        if(x!=wut[i].q)
        {
            if(n>1000)
                printf("%I64d %I64d \n",x,wut[i].q);
            printf("NO\n");
            return 0;
        }
    }
    //fillpls(0,0,n-1);
    printf("YES\n");
    for(int i=0;i<n;i++)
        printf("%d ",ar[i]);
    printf("\n");
    return 0;
}


#include<stdio.h>
#include<iostream>

#define l 2*pos+1
#define r 2*pos+2
#define mid (start+stop)/2
using namespace std;
long long segtree[1000000];
long long lazy[1000000];
long long ar[100005];

long long read()
{
    char c=getchar();
    long long ans=0;
    while(c<'0' || c>'9')
        c=getchar();
    while(c>='0'&&c<='9')
    {
        ans=(ans<<3)+(ans<<1)+c-'0';
        c=getchar();
    }
    return ans;
}

void fillpls(int pos,int start, int stop)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;

    }
    if(start==stop)
    {
        ar[start]=segtree[pos];
        return;
    }
    fillpls(l,start,mid);
    fillpls(r,mid+1,stop);
    return;
}

void update(int pos,int start,int stop,int i,int j, long long q)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;

    }
    if(start==stop)
    {
        segtree[pos]|=q;
        ar[start]|=q;
        return;
    }
    if(start>=i && stop<=j)
    {
        segtree[pos]|=q;
        lazy[l]|=q;
        lazy[r]|=q;
        return;
    }
    if(j<=mid)
        update(l,start,mid,i,j,q);
    if(i>=mid+1)
        update(r,mid+1,stop,i,j,q);

    segtree[pos]=segtree[l]&segtree[r];

    return;
}

long long query(int pos,int start,int stop,int i,int j)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;
    }
    if(start>=i && stop<=j)
        return segtree[pos];

    long long aristera=-1,deksia=-1;
    if(j<=mid)
        aristera=query(l,start,mid,i,j);
    if(i>=mid+1)
        deksia=query(r,mid+1,stop,i,j);

    if(aristera==-1)
        return deksia;
    if(deksia==-1)
        return aristera;

    return aristera&deksia;

}

struct poulla
{
    int left,right;
    long long q;
};

int main()
{
    /*int a=(69|420)|666;
    int b=69|(420|666);

    cout<<a<<" "<<b;*/
    int n,m;
    //scanf("%d %d",&n,&m);
    n=read();
    m=read();
    poulla wut[m];
    for(int i=0;i<m;i++)
    {
       //scanf("%d %d %d",&wut[i].left,&wut[i].right,&wut[i].q);
       wut[i].left=read();
       wut[i].right=read();
       wut[i].q=read();
       if(n==1000 && 80<=i && i<120)
        printf("%d %d %d \n",wut[i].left,wut[i].right,wut[i].q);
       update(0,0,n-1,wut[i].left-1,wut[i].right-1,wut[i].q);
    }
    for(int i=0;i<m;i++)
    {
        int s=query(0,0,n-1,wut[i].left-1,wut[i].right-1);
        if(s!=wut[i].q)
        {
            /*if(n>100)
            printf("%I64d != %I64d \n",s,wut[i].q);*/
            printf("NO\n");
            return 0;
        }
    }
    fillpls(0,0,n-1);
    printf("YES\n");
    for(int i=0;i<n;i++)
        printf("%d ",ar[i]);
    printf("\n");
    return 0;
}


#include<stdio.h>
#include<iostream>

#define l 2*pos+1
#define r 2*pos+2
#define mid (start+stop)/2
using namespace std;
int segtree[1000000];
int lazy[1000000];
int ar[100005];

int read()
{
    char c=getchar();
    int ans=0;
    while(c<'0' || c>'9')
        c=getchar();
    while(c>='0'&&c<='9')
    {
        ans=(ans<<3)+(ans<<1)+c-'0';
        c=getchar();
    }
    return ans;
}

void fillpls(int pos,int start, int stop)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]=lazy[pos];
        lazy[r]=lazy[pos];
        lazy[pos]=0;

    }
    if(start==stop)
    {
        ar[start]=segtree[pos];
        return;
    }
    fillpls(l,start,mid);
    fillpls(r,mid+1,stop);
    return;
}

void update(int pos,int start,int stop,int i,int j, int q)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;

    }
    if(start==stop)
    {
        segtree[pos]|=q;
        ar[start]|=q;
        return;
    }
    if(start>=i && stop<=j)
    {
        segtree[pos]|=q;
        lazy[l]|=q;
        lazy[r]|=q;
        return;
    }
    if(i<=mid)
        update(l,start,mid,i,j,q);
    if(j>=mid+1)
        update(r,mid+1,stop,i,j,q);

    segtree[pos]=segtree[l]&segtree[r];

    return;
}

int query(int pos,int start,int stop,int i,int j)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]|=lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;
    }
    if(start>=i && stop<=j)
        return segtree[pos];

    int aristera=-1,deksia=-1;
    if(i<=mid)
        aristera=query(l,start,mid,i,j);
    if(j>=mid+1)
        deksia=query(r,mid+1,stop,i,j);

    if(aristera==-1)
        return deksia;
    if(deksia==-1)
        return aristera;

    return aristera&deksia;

}

struct poulla
{
    int left,right;
    int q;
};

int main()
{
    /*int a=(69|420)|666;
    int b=69|(420|666);

    cout<<a<<" "<<b;*/
    int n,m;
    //scanf("%d %d",&n,&m);
    n=read();
    m=read();
    poulla wut[m];
    for(int i=0;i<m;i++)
    {
       //scanf("%d %d %d",&wut[i].left,&wut[i].right,&wut[i].q);
       wut[i].left=read();
       wut[i].right=read();
       wut[i].q=read();
       update(0,0,n-1,wut[i].left-1,wut[i].right-1,wut[i].q);
    }
    for(int i=0;i<m;i++)
    {
        if(query(0,0,n-1,wut[i].left-1,wut[i].right-1)!=wut[i].q)
        {
            printf("NO\n");
            return 0;
        }
    }
    fillpls(0,0,n-1);
    printf("YES\n");
    for(int i=0;i<n;i++)
        printf("%d ",ar[i]);
    printf("\n");
    return 0;
}


#include<stdio.h>
#include<iostream>

#define l 2*pos+1
#define r 2*pos+2
#define mid (start+stop)/2
using namespace std;
long long int segtree[300005];
long long int lazy[300005];
long long int ar[100005];

long long  read()
{
    char c=getchar();
    int ans=0;
    while(c<'0' || c>'9')
        c=getchar();
    while(c>='0'&&c<='9')
    {
        ans=(ans<<3)+(ans<<1)+c-'0';
        c=getchar();
    }
    return ans;
}
//kkk
void fillpls(int pos,int start,int stop)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        segtree[l]|=lazy[pos];
        segtree[r]|=lazy[pos];
        lazy[pos]=0;
    }
    if(start==stop)
    {
        ar[start]=segtree[pos];
        return;
    }
    fillpls(l,start,mid);
    fillpls(r,mid+1,stop);
    segtree[pos]=segtree[l]&segtree[r];
    return;
}

void update(int pos,int start,int stop,int i,int j, long long q)
{
    if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        segtree[l]|=lazy[pos];
        segtree[r]|=lazy[pos];
        lazy[pos]=0;
    }
    if(start==stop)
    {
        segtree[pos]|=q;
        ar[start]|=q;
        return;
    }
    if(start>=i &&stop<=j)
    {
        segtree[pos]|=q;
        lazy[l]|=q;
        lazy[r]|=q;
        return;
    }
    if(i<=mid)
        update(l,start,mid,i,j,q);
    if(j>=mid+1)
        update(r,mid+1,stop,i,j,q);

    segtree[pos]=segtree[l]&segtree[r];

    return;
}

long long query(int pos,int start,int stop,int i,int j)
{
    /*if(lazy[pos]>0)
    {
        segtree[pos]|=lazy[pos];
        lazy[l]||lazy[pos];
        lazy[r]|=lazy[pos];
        lazy[pos]=0;
    }*/
    if(start>=i && stop<=j)
        return segtree[pos];

    int aristera=-1,deksia=-1;
    if(i<=mid)
        aristera=query(l,start,mid,i,j);
    if(j>=mid+1)
        deksia=query(r,mid+1,stop,i,j);

    if(aristera==-1)
        return deksia;
    if(deksia==-1)
        return aristera;

    return aristera&deksia;

}

struct poulla
{
    int left,right;
    long long q;
};

int main()
{
    //for(int i=0;i<300000;i++)
      //  lazy[i]=0;
    int n,m;
    //scanf("%d %d",&n,&m);
    n=read();
    m=read();
    poulla wut[m];
    for(int i=0;i<m;i++)
    {
       //scanf("%d %d %d",&wut[i].left,&wut[i].right,&wut[i].q);
       wut[i].left=read();
       wut[i].right=read();
       wut[i].q=read();
       update(0,0,n-1,wut[i].left-1,wut[i].right-1,wut[i].q);
    }
    for(int i=0;i<m;i++)
    {
        fillpls(0,0,n-1);
        if(query(0,0,n-1,wut[i].left-1,wut[i].right-1)!=wut[i].q)
        {
            printf("NO\n");
            return 0;
        }
    }
    //fillpls(0,0,n-1);
    printf("YES\n");
    for(int i=0;i<n;i++)
        printf("%d ",ar[i]);
    printf("\n");
    return 0;
}


#include <cstdio>
#include <vector>
#include <stack>
#include <cstring>
#define MAXN 100005
#define INF 1000000
#define mid ((bgn+end)/2)
using namespace std;
int n,m,l[MAXN],r[MAXN],q[MAXN];
int seg[MAXN*4][30],lazy[MAXN*4][30];
inline int up(int lvl,int bgn,int end,int b,int e,int wh)
{
	//~ printf("up %d %d %d %d %d %d\n",lvl,bgn,end,b,e,wh);
	if(bgn>e || end<b) return seg[lvl][wh] || lazy[lvl][wh];
	if(b<=bgn && end<=b)
	{
		lazy[lvl][wh]=1;
		return seg[lvl][wh] || lazy[lvl][wh];
	}
	seg[lvl][wh]=up(lvl*2,bgn,mid,b,e,wh) & up(lvl*2+1,mid+1,end,b,e,wh);
	return seg[lvl][wh] || lazy[lvl][wh];
}
inline int ask(int lvl,int bgn,int end,int b,int e,int wh)
{
	if(bgn>e || end<b) return 1;
	if(b<=bgn && end<=e) return seg[lvl][wh] || lazy[lvl][wh];
	return lazy[lvl] || (ask(lvl*2,bgn,mid,b,e,wh) && ask(lvl*2+1,mid+1,end,b,e,wh));
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d %d",&l[i],&r[i],&q[i]);
		for(int j=0;j<30;j++)
			if(q[i] & (1<<j))
			{
				//~ printf("up %d %d %d\n",l[i],r[i],j);
				up(1,1,n,l[i],r[i],j);
			}
	}
	for(int i=1;i<=m;i++)
	{
		for(int j=0;j<30;j++)
			if(!(q[i] & (1<<j)))
				if(ask(1,1,n,l[i],r[i],j))
				{
					printf("NO\n");
					//~ printf("%d\n",ask(1,1,n,l[i],r[i],j));
					return 0;
				}
	}
	puts("YES");
	for(int i=1;i<=n;i++)
	{
		int tem=0;
		for(int j=0;j<30;j++)
		{
			tem+=(ask(1,1,n,i,i,j) << j);
			//~ printf("%d ",ask(1,1,n,i,i,j));
		}
		printf("%d ",tem);
		//~ puts("");
	}
}
/*
5 3
1 3 9
1 5 8
5 5 14

*/


#include <cstdio>
#include <vector>
#include <stack>
#include <cstring>
#define MAXN 100005
#define INF 1000000
#define mid ((bgn+end)/2)
using namespace std;
int n,m,l[MAXN],r[MAXN],q[MAXN];
int seg[MAXN*4][30],lazy[MAXN*4][30];
int up(int lvl,int bgn,int end,int b,int e,int wh)
{
	//~ printf("up %d %d %d %d %d %d\n",lvl,bgn,end,b,e,wh);
	if(bgn>e || end<b) return seg[lvl][wh] || lazy[lvl][wh];
	if(b<=bgn && end<=e)
	{
		lazy[lvl][wh]=1;
		return seg[lvl][wh] || lazy[lvl][wh];
	}
	seg[lvl][wh]=up(lvl*2,bgn,mid,b,e,wh) & up(lvl*2+1,mid+1,end,b,e,wh);
	return seg[lvl][wh] || lazy[lvl][wh];
}
int ask(int lvl,int bgn,int end,int b,int e,int wh)
{
	if(bgn>e || end<b) return 1;
	if(b<=bgn && end<=e) return seg[lvl][wh] || lazy[lvl][wh];
	return lazy[lvl][wh] || (ask(lvl*2,bgn,mid,b,e,wh) && ask(lvl*2+1,mid+1,end,b,e,wh));
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d %d",&l[i],&r[i],&q[i]);
		for(int j=0;j<30;j++)
			if(q[i] & (1<<j))
			{
				//~ printf("up %d %d %d\n",l[i],r[i],j);
				up(1,1,n,l[i],r[i],j);
			}
	}
	for(int i=1;i<=m;i++)
	{
		for(int j=0;j<30;j++)
			if(!(q[i] & (1<<j)))
				if(ask(1,1,n,l[i],r[i],j))
				{
					printf("NO\n");
					//~ printf("%d\n",ask(1,1,n,l[i],r[i],j));
					return 0;
				}
	}
	puts("YES");
	for(int i=1;i<=n;i++)
	{
		int tem=0;
		for(int j=0;j<30;j++)
		{
			tem+=(ask(1,1,n,i,i,j) << j);
			//~ printf("%d ",ask(1,1,n,i,i,j));
		}
		printf("%d ",tem);
		//~ puts("");
	}
}
/*
5 3
1 3 9
1 5 8
5 5 14

*/


#include <cstdio>
#include <vector>
#include <stack>
#include <cstring>
#define MAXN 100005
#define INF 1000000
#define mid ((bgn+end)/2)
using namespace std;
int n,m,l[MAXN],r[MAXN],q[MAXN];
int seg[MAXN*4],lazy[MAXN*4];
inline bool up(int lvl,int bgn,int end,int b,int e,int wh)
{
	//~ printf("up %d %d %d %d %d %d\n",lvl,bgn,end,b,e,wh);
	if(bgn>e || end<b) return (seg[lvl] & (1 << wh)) || (lazy[lvl] & (1 << wh));
	if(b<=bgn && end<=e)
	{
		lazy[lvl] +=(1 << wh);
		return (seg[lvl] & (1 << wh)) || (lazy[lvl] & (1 << wh));
	}
	if(up(lvl*2,bgn,mid,b,e,wh) & up(lvl*2+1,mid+1,end,b,e,wh))
			seg[lvl]=seg[lvl] | (1 << wh);
	return (seg[lvl] & (1 << wh)) || (lazy[lvl] & (1 << wh));
}
inline bool ask(int lvl,int bgn,int end,int b,int e,int wh)
{
	if(bgn>e || end<b) return 1;
	if(b<=bgn && end<=e) return (seg[lvl] & (1 << wh)) || (lazy[lvl] & (1 << wh));
	return (lazy[lvl] & (1 << wh)) || (ask(lvl*2,bgn,mid,b,e,wh) && ask(lvl*2+1,mid+1,end,b,e,wh));
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d %d",&l[i],&r[i],&q[i]);
		for(int j=0;j<30;j++)
			if(q[i] & (1<<j))
			{
				//~ printf("up %d %d %d\n",l[i],r[i],j);
				up(1,1,n,l[i],r[i],j);
			}
	}
	for(int i=1;i<=m;i++)
	{
		for(int j=0;j<30;j++)
			if(!(q[i] & (1<<j)))
				if(ask(1,1,n,l[i],r[i],j))
				{
					printf("NO\n");
					//~ printf("%d\n",ask(1,1,n,l[i],r[i],j));
					return 0;
				}
	}
	puts("YES");
	for(int i=1;i<=n;i++)
	{
		int tem=0;
		for(int j=0;j<30;j++)
		{
			tem+=(ask(1,1,n,i,i,j) << j);
			//~ printf("%d ",ask(1,1,n,i,i,j));
		}
		printf("%d ",tem);
		//~ puts("");
	}
}
/*
5 3
1 3 9
1 5 8
5 5 14

*/


#include <cstdio>
#include <vector>
#include <stack>
#include <cstring>
#define MAXN 100005
#define INF 1000000
#define mid ((bgn+end)/2)
using namespace std;
int n,m,l[MAXN],r[MAXN],q[MAXN];
int seg[MAXN*4],lazy[MAXN*4];
inline bool up(int lvl,int bgn,int end,int b,int e,int wh)
{
	//~ printf("up %d %d %d %d %d %d\n",lvl,bgn,end,b,e,wh);
	if(bgn>e || end<b) return (seg[lvl] & (1 << wh)) || (lazy[lvl] & (1 << wh));
	if(b<=bgn && end<=e)
	{
		lazy[lvl]=(lazy[lvl] | (1 << wh));
		return (seg[lvl] & (1 << wh)) || (lazy[lvl] & (1 << wh));
	}
	if(up(lvl*2,bgn,mid,b,e,wh) & up(lvl*2+1,mid+1,end,b,e,wh))
			seg[lvl]=seg[lvl] | (1 << wh);
	return (seg[lvl] & (1 << wh)) || (lazy[lvl] & (1 << wh));
}
inline bool ask(int lvl,int bgn,int end,int b,int e,int wh)
{
	if(bgn>e || end<b) return 1;
	if(b<=bgn && end<=e) return (seg[lvl] & (1 << wh)) || (lazy[lvl] & (1 << wh));
	return (lazy[lvl] & (1 << wh)) || (ask(lvl*2,bgn,mid,b,e,wh) && ask(lvl*2+1,mid+1,end,b,e,wh));
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d %d",&l[i],&r[i],&q[i]);
		for(int j=0;j<30;j++)
			if(q[i] & (1<<j))
			{
				//~ printf("up %d %d %d\n",l[i],r[i],j);
				up(1,1,n,l[i],r[i],j);
			}
	}
	for(int i=1;i<=m;i++)
	{
		for(int j=0;j<30;j++)
			if(!(q[i] & (1<<j)))
				if(ask(1,1,n,l[i],r[i],j))
				{
					printf("NO\n");
					//~ printf("%d\n",ask(1,1,n,l[i],r[i],j));
					return 0;
				}
	}
	puts("YES");
	for(int i=1;i<=n;i++)
	{
		int tem=0;
		for(int j=0;j<30;j++)
		{
			tem+=(ask(1,1,n,i,i,j) << j);
			//~ printf("%d ",ask(1,1,n,i,i,j));
		}
		printf("%d ",tem);
		//~ puts("");
	}
}
/*
5 3
1 3 9
1 5 8
5 5 14

*/


#include <cstdio>
#include <vector>
#include <stack>
#include <cstring>
#define MAXN 100005
#define INF 1000000
#define mid ((bgn+end)/2)
using namespace std;
int n,m,l[MAXN],r[MAXN],q[MAXN];
int seg[MAXN][30],lazy[MAXN][30];
int up(int lvl,int bgn,int end,int b,int e,int wh)
{
	if(bgn>e || end<b) return seg[lvl][wh] & lazy[lvl][wh];
	if(b<=bgn && end<=e)
	{
		lazy[lvl][wh]=1;
		return seg[lvl][wh] || lazy[lvl][wh];
	}
	seg[lvl][wh]=up(lvl*2,bgn,mid,b,e,wh)&up(lvl*2,mid+1,end,b,e,wh);
	return seg[lvl][wh]||lazy[lvl][wh];
}
int ask(int lvl,int bgn,int end,int b,int e,int wh)
{
	if(bgn>e || end<b) return 1;
	if(b<=bgn && end<=e) return seg[lvl][wh] || lazy[lvl][wh];
	return (ask(lvl*2,bgn,mid,b,e,wh)&ask(lvl*2,mid+1,end,b,e,wh))||lazy[lvl][wh];
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d %d",&l[i],&r[i],&q[i]);
		for(int j=0;j<30;j++)
			if(q[i] & (1<<j))
				up(1,1,n,l[i],r[i],j);
	}
	for(int i=1;i<=m;i++)
	{
		for(int j=0;j<30;j++)
			if(!(q[i] & (1<<j)))
				if(ask(1,1,n,l[i],r[i],j))
				{
					printf("NO\n");
					return 0;
				}
	}
	puts("YES");
	for(int i=1;i<=n;i++)
	{
		int tem=0;
		for(int j=0;j<30;j++)
		{
			tem+=(ask(1,1,n,i,i,j) << j);
			//~ printf("%d ",(ask(1,1,n,i,i,j) << j));
		}
		printf("%d ",tem);
		//~ puts("");
	}
}


#include <cstdio>
#include <vector>
#include <stack>
#include <cstring>
#define MAXN 100005
#define INF 1000000
#define mid ((bgn+end)/2)
using namespace std;
int n,m,l[MAXN],r[MAXN],q[MAXN];
int seg[MAXN*4][30],lazy[MAXN*4][30];
inline int up(int lvl,int bgn,int end,int b,int e,int wh)
{
	//~ printf("up %d %d %d %d %d %d\n",lvl,bgn,end,b,e,wh);
	if(bgn>e || end<b) return seg[lvl][wh] || lazy[lvl][wh];
	if(b<=bgn && end<=e)
	{
		lazy[lvl][wh]=1;
		return seg[lvl][wh] || lazy[lvl][wh];
	}
	seg[lvl][wh]=up(lvl*2,bgn,mid,b,e,wh) & up(lvl*2+1,mid+1,end,b,e,wh);
	return seg[lvl][wh] || lazy[lvl][wh];
}
inline int ask(int lvl,int bgn,int end,int b,int e,int wh)
{
	if(bgn>e || end<b) return 1;
	if(b<=bgn && end<=e) return seg[lvl][wh] || lazy[lvl][wh];
	return lazy[lvl] || (ask(lvl*2,bgn,mid,b,e,wh) && ask(lvl*2+1,mid+1,end,b,e,wh));
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d %d",&l[i],&r[i],&q[i]);
		for(int j=0;j<30;j++)
			if(q[i] & (1<<j))
			{
				//~ printf("up %d %d %d\n",l[i],r[i],j);
				up(1,1,n,l[i],r[i],j);
			}
	}
	for(int i=1;i<=m;i++)
	{
		for(int j=0;j<30;j++)
			if(!(q[i] & (1<<j)))
				if(ask(1,1,n,l[i],r[i],j))
				{
					printf("NO\n");
					//~ printf("%d\n",ask(1,1,n,l[i],r[i],j));
					return 0;
				}
	}
	puts("YES");
	for(int i=1;i<=n;i++)
	{
		int tem=0;
		for(int j=0;j<30;j++)
		{
			tem+=(ask(1,1,n,i,i,j) << j);
			//~ printf("%d ",ask(1,1,n,i,i,j));
		}
		printf("%d ",tem);
		//~ puts("");
	}
}
/*
5 3
1 3 9
1 5 8
5 5 14

*/


#include <cstdio>
#include <vector>
#include <stack>
#include <cstring>
#define MAXN 100005
#define INF 1000000
#define mid ((bgn+end)/2)
using namespace std;
int n,m,l[MAXN],r[MAXN],q[MAXN];
int seg[MAXN*4],lazy[MAXN*4];
inline int up(int lvl,int bgn,int end,int b,int e,int wh)
{
	//~ printf("up %d %d %d %d %d %d\n",lvl,bgn,end,b,e,wh);
	if(bgn>e || end<b) return (seg[lvl] & (1 << wh)) || (lazy[lvl] & (1 << wh));
	if(b<=bgn && end<=e)
	{
		lazy[lvl] +=(1 << wh);
		return (seg[lvl] & (1 << wh)) || (lazy[lvl] & (1 << wh));
	}
	if(up(lvl*2,bgn,mid,b,e,wh) & up(lvl*2+1,mid+1,end,b,e,wh))
			seg[lvl]=seg[lvl] | (1 << wh);
	return (seg[lvl] & (1 << wh)) || (lazy[lvl] & (1 << wh));
}
inline int ask(int lvl,int bgn,int end,int b,int e,int wh)
{
	if(bgn>e || end<b) return 1;
	if(b<=bgn && end<=e) return (seg[lvl] & (1 << wh)) || (lazy[lvl] & (1 << wh));
	return (lazy[lvl] & (1 << wh)) || (ask(lvl*2,bgn,mid,b,e,wh) && ask(lvl*2+1,mid+1,end,b,e,wh));
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d %d",&l[i],&r[i],&q[i]);
		for(int j=0;j<30;j++)
			if(q[i] & (1<<j))
			{
				//~ printf("up %d %d %d\n",l[i],r[i],j);
				up(1,1,n,l[i],r[i],j);
			}
	}
	for(int i=1;i<=m;i++)
	{
		for(int j=0;j<30;j++)
			if(!(q[i] & (1<<j)))
				if(ask(1,1,n,l[i],r[i],j))
				{
					printf("NO\n");
					//~ printf("%d\n",ask(1,1,n,l[i],r[i],j));
					return 0;
				}
	}
	puts("YES");
	for(int i=1;i<=n;i++)
	{
		int tem=0;
		for(int j=0;j<30;j++)
		{
			tem+=(ask(1,1,n,i,i,j) << j);
			//~ printf("%d ",ask(1,1,n,i,i,j));
		}
		printf("%d ",tem);
		//~ puts("");
	}
}
/*
5 3
1 3 9
1 5 8
5 5 14

*/


#include <cstdio>
#include <vector>
#include <stack>
#include <cstring>
#define MAXN 100005
#define INF 1000000
#define mid ((bgn+end)/2)
using namespace std;
int n,m,l[MAXN],r[MAXN],q[MAXN];
int seg[MAXN][30],lazy[MAXN][30];
int up(int lvl,int bgn,int end,int b,int e,int wh)
{
	//~ printf("up %d %d %d %d %d %d\n",lvl,bgn,end,b,e,wh);
	if(bgn>e || end<b) return seg[lvl][wh] || lazy[lvl][wh];
	if(b<=bgn && end<=e)
	{
		lazy[lvl][wh]=1;
		return seg[lvl][wh] || lazy[lvl][wh];
	}
	seg[lvl][wh]=up(lvl*2,bgn,mid,b,e,wh) & up(lvl*2+1,mid+1,end,b,e,wh);
	return seg[lvl][wh] || lazy[lvl][wh];
}
int ask(int lvl,int bgn,int end,int b,int e,int wh)
{
	if(bgn>e || end<b) return 1;
	if(b<=bgn && end<=e) return seg[lvl][wh] || lazy[lvl][wh];
	return (ask(lvl*2,bgn,mid,b,e,wh) & ask(lvl*2+1,mid+1,end,b,e,wh)) || lazy[lvl][wh];
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d %d",&l[i],&r[i],&q[i]);
		for(int j=0;j<30;j++)
			if(q[i] & (1<<j))
			{
				//~ printf("up %d %d %d\n",l[i],r[i],j);
				up(1,1,n,l[i],r[i],j);
			}
	}
	for(int i=1;i<=m;i++)
	{
		for(int j=0;j<30;j++)
			if(!(q[i] & (1<<j)))
				if(ask(1,1,n,l[i],r[i],j))
				{
					printf("NO\n");
					//~ printf("%d\n",ask(1,1,n,l[i],r[i],j));
					return 0;
				}
	}
	puts("YES");
	for(int i=1;i<=n;i++)
	{
		int tem=0;
		for(int j=0;j<30;j++)
		{
			tem+=(ask(1,1,n,i,i,j) << j);
			//~ printf("%d ",ask(1,1,n,i,i,j));
		}
		printf("%d ",tem);
		//~ puts("");
	}
}
/*
5 3
1 3 9
1 5 8
5 5 14

*/


#include <cstdio>
#include <vector>
#include <stack>
#include <cstring>
#define MAXN 100005
#define INF 1000000
#define mid ((bgn+end)/2)
using namespace std;
int n,m,l[MAXN],r[MAXN],q[MAXN];
int seg[MAXN*4][30],lazy[MAXN*4][30];
inline int up(int lvl,int bgn,int end,int b,int e,int wh)
{
	//~ printf("up %d %d %d %d %d %d\n",lvl,bgn,end,b,e,wh);
	if(bgn>e || end<b) return seg[lvl][wh] || lazy[lvl][wh];
	if(b<=bgn && end<=e)
	{
		lazy[lvl][wh]=1;
		return seg[lvl][wh] || lazy[lvl][wh];
	}
	seg[lvl][wh]=up(lvl*2,bgn,mid,b,e,wh) & up(lvl*2+1,mid+1,end,b,e,wh);
	return seg[lvl][wh] || lazy[lvl][wh];
}
inline int ask(int lvl,int bgn,int end,int b,int e,int wh)
{
	if(bgn>e || end<b) return 1;
	if(b<=bgn && end<=e) return seg[lvl][wh] || lazy[lvl][wh];
	return lazy[lvl][wh] || (ask(lvl*2,bgn,mid,b,e,wh) && ask(lvl*2+1,mid+1,end,b,e,wh));
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d %d",&l[i],&r[i],&q[i]);
		for(int j=0;j<30;j++)
			if(q[i] & (1<<j))
			{
				//~ printf("up %d %d %d\n",l[i],r[i],j);
				up(1,1,n,l[i],r[i],j);
			}
	}
	for(int i=1;i<=m;i++)
	{
		for(int j=0;j<30;j++)
			if(!(q[i] & (1<<j)))
				if(ask(1,1,n,l[i],r[i],j))
				{
					printf("NO\n");
					//~ printf("%d\n",ask(1,1,n,l[i],r[i],j));
					return 0;
				}
	}
	puts("YES");
	for(int i=1;i<=n;i++)
	{
		int tem=0;
		for(int j=0;j<30;j++)
		{
			tem+=(ask(1,1,n,i,i,j) << j);
			//~ printf("%d ",ask(1,1,n,i,i,j));
		}
		printf("%d ",tem);
		//~ puts("");
	}
}
/*
5 3
1 3 9
1 5 8
5 5 14

*/


#include <cstdio>
#include <vector>
#include <stack>
#include <cstring>
#define MAXN 100005
#define INF 1000000
#define mid ((bgn+end)/2)
using namespace std;
int n,m,l[MAXN],r[MAXN],q[MAXN];
int seg[MAXN*4],lazy[MAXN*4];
inline int up(int lvl,int bgn,int end,int b,int e,int wh)
{
	//~ printf("up %d %d %d %d %d %d\n",lvl,bgn,end,b,e,wh);
	if(bgn>e || end<b) return (seg[lvl] & (1 << wh)) || (lazy[lvl] & (1 << wh));
	if(b<=bgn && end<=e)
	{
		lazy[lvl] +=(1 << wh);
		return (seg[lvl] & (1 << wh)) || (lazy[lvl] & (1 << wh));
	}
	if(up(lvl*2,bgn,mid,b,e,wh) & up(lvl*2+1,mid+1,end,b,e,wh))
		if(!(seg[lvl] & (1 << wh)))
			seg[lvl]+=(1 << wh);
	return (seg[lvl] & (1 << wh)) || (lazy[lvl] & (1 << wh));
}
inline int ask(int lvl,int bgn,int end,int b,int e,int wh)
{
	if(bgn>e || end<b) return 1;
	if(b<=bgn && end<=e) return (seg[lvl] & (1 << wh)) || (lazy[lvl] & (1 << wh));
	return (lazy[lvl] & (1 << wh)) || (ask(lvl*2,bgn,mid,b,e,wh) && ask(lvl*2+1,mid+1,end,b,e,wh));
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d %d",&l[i],&r[i],&q[i]);
		for(int j=0;j<30;j++)
			if(q[i] & (1<<j))
			{
				//~ printf("up %d %d %d\n",l[i],r[i],j);
				up(1,1,n,l[i],r[i],j);
			}
	}
	for(int i=1;i<=m;i++)
	{
		for(int j=0;j<30;j++)
			if(!(q[i] & (1<<j)))
				if(ask(1,1,n,l[i],r[i],j))
				{
					printf("NO\n");
					//~ printf("%d\n",ask(1,1,n,l[i],r[i],j));
					return 0;
				}
	}
	puts("YES");
	for(int i=1;i<=n;i++)
	{
		int tem=0;
		for(int j=0;j<30;j++)
		{
			tem+=(ask(1,1,n,i,i,j) << j);
			//~ printf("%d ",ask(1,1,n,i,i,j));
		}
		printf("%d ",tem);
		//~ puts("");
	}
}
/*
5 3
1 3 9
1 5 8
5 5 14

*/


#include <cstdio>
#include <vector>
#include <stack>
#include <cstring>
#define MAXN 100005
#define INF 1000000
#define mid ((bgn+end)/2)
using namespace std;
int n,m,l[MAXN],r[MAXN],q[MAXN];
int seg[MAXN][30],lazy[MAXN][30];
int up(int lvl,int bgn,int end,int b,int e,int wh)
{
	if(bgn>e || end<b) return seg[lvl][wh] || lazy[lvl][wh];
	if(b<=bgn && end<=e)
	{
		lazy[lvl][wh]=1;
		return seg[lvl][wh] || lazy[lvl][wh];
	}
	seg[lvl][wh]=up(lvl*2,bgn,mid,b,e,wh)&up(lvl*2,mid+1,end,b,e,wh);
	return seg[lvl][wh]||lazy[lvl][wh];
}
int ask(int lvl,int bgn,int end,int b,int e,int wh)
{
	if(bgn>e || end<b) return 1;
	if(b<=bgn && end<=e) return seg[lvl][wh] || lazy[lvl][wh];
	return (ask(lvl*2,bgn,mid,b,e,wh)&ask(lvl*2,mid+1,end,b,e,wh))||lazy[lvl][wh];
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d %d",&l[i],&r[i],&q[i]);
		for(int j=0;j<30;j++)
			if(q[i] & (1<<j))
				up(1,1,n,l[i],r[i],j);
	}
	for(int i=1;i<=m;i++)
	{
		for(int j=0;j<30;j++)
			if(!(q[i] & (1<<j)))
				if(ask(1,1,n,l[i],r[i],j))
				{
					printf("NO\n");
					return 0;
				}
	}
	puts("YES");
	for(int i=1;i<=n;i++)
	{
		int tem=0;
		for(int j=0;j<30;j++)
		{
			tem+=(ask(1,1,n,i,i,j) << j);
			//~ printf("%d ",(ask(1,1,n,i,i,j) << j));
		}
		printf("%d ",tem);
		//~ puts("");
	}
}


#include <cstdio>
#include <vector>
#include <stack>
#include <cstring>
#define MAXN 100005
#define INF 1000000
#define mid ((bgn+end)/2)
using namespace std;
int n,m,l[MAXN],r[MAXN],q[MAXN];
int seg[MAXN*4][30],lazy[MAXN*4][30];
int up(int lvl,int bgn,int end,int b,int e,int wh)
{
	//~ printf("up %d %d %d %d %d %d\n",lvl,bgn,end,b,e,wh);
	if(bgn>e || end<b) return seg[lvl][wh] || lazy[lvl][wh];
	if(b<=bgn && end<=e)
	{
		lazy[lvl][wh]=1;
		return seg[lvl][wh] || lazy[lvl][wh];
	}
	seg[lvl][wh]=up(lvl*2,bgn,mid,b,e,wh) & up(lvl*2+1,mid+1,end,b,e,wh);
	return seg[lvl][wh] || lazy[lvl][wh];
}
int ask(int lvl,int bgn,int end,int b,int e,int wh)
{
	if(bgn>e || end<b) return 1;
	if(b<=bgn && end<=e) return seg[lvl][wh] || lazy[lvl][wh];
	return (ask(lvl*2,bgn,mid,b,e,wh) & ask(lvl*2+1,mid+1,end,b,e,wh)) || lazy[lvl][wh];
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d %d %d",&l[i],&r[i],&q[i]);
		for(int j=0;j<30;j++)
			if(q[i] & (1<<j))
			{
				//~ printf("up %d %d %d\n",l[i],r[i],j);
				up(1,1,n,l[i],r[i],j);
			}
	}
	for(int i=1;i<=m;i++)
	{
		for(int j=0;j<30;j++)
			if(!(q[i] & (1<<j)))
				if(ask(1,1,n,l[i],r[i],j))
				{
					printf("NO\n");
					//~ printf("%d\n",ask(1,1,n,l[i],r[i],j));
					return 0;
				}
	}
	puts("YES");
	for(int i=1;i<=n;i++)
	{
		int tem=0;
		for(int j=0;j<30;j++)
		{
			tem+=(ask(1,1,n,i,i,j) << j);
			//~ printf("%d ",ask(1,1,n,i,i,j));
		}
		printf("%d ",tem);
		//~ puts("");
	}
}
/*
5 3
1 3 9
1 5 8
5 5 14

*/


#define  _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<map>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<stack>
#include<math.h>
#include<set>
#include<string>
#include<cstring>
#include<queue>
#include<complex>
#include<assert.h>
#include<math.h>
#include<memory.h>
#include<sstream>
#include<cstdio>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define repi(i,a,n) for(int i=a;i<n;i++)
#define INF (0x7fffffff)
#define mp make_pair
#define fastIO ios::sync_with_stdio(false)
#define read freopen("in.in","r",stdin)
#define write freopen("out.out","w",stdout)
#define scf(xx) scanf("%d",&xx)
#define All(a) a.begin(), a.end()
#define LSOne(S) (S & (-S))

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long double ld;

#define open first
#define close second

int n, m;
int tree[400010];
int a[100010];
void build(int p = 1 , int s = 0, int e = n - 1){
	if (s == e){
		tree[p] = a[s];
		return;
	}
	build(2 * p, s, (s + e) / 2);
	build(2 * p + 1, (s + e) / 2 + 1, e);
	tree[p] = tree[p * 2] & tree[p * 2 + 1];
}
int query(int l, int r, int p = 1, int s = 0, int e = n - 1){
	if (s >=l && e <= r)return tree[p];
	if (e < l || s > r)return INF;
	return query(l, r, 2 * p, s, (s + e) / 2)&query(l, r, 2 * p + 1, (s + e) / 2 + 1, e);
}

int bit[31][100010];
pair<ii,int> q[100010];

int main(){
	fastIO;
	//read; write;
	cin >> n >> m;
	rep(i, m){
		cin >> q[i].first.first >> q[i].first.second >> q[i].second;
		q[i].first.first--; q[i].first.second--;
		rep(j, 31)if ((q[i].second & 1 << j) != 0) bit[j][q[i].first.first] += 1, bit[j][q[i].first.second + 1] -= 1;
	}
	rep(i, n)a[i] = 0;
	rep(i, 31){
		int c = 0;
		rep(j, n){
			if (j == 17){
				bit[0][0]++;
			}
			c += bit[i][j];
			if (c) a[j] |= 1 << i;
		}
	}
	build();
	rep(i, m){
		if (q[i].second != query(q[i].first.first, q[i].first.second)){
			cout << "NO";
			return 0;
		}
	}
	cout << "YES\n";
	rep(i, n)cout << a[i] << " ";
	return 0;
}


#define  _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<map>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<stack>
#include<math.h>
#include<set>
#include<string>
#include<cstring>
#include<queue>
#include<complex>
#include<assert.h>
#include<math.h>
#include<memory.h>
#include<sstream>
#include<cstdio>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define repi(i,a,n) for(int i=a;i<n;i++)
#define INF (0x7fffffff)
#define mp make_pair
#define fastIO ios::sync_with_stdio(false)
#define read freopen("in.in","r",stdin)
#define write freopen("out.out","w",stdout)
#define scf(xx) scanf("%d",&xx)
#define All(a) a.begin(), a.end()
#define LSOne(S) (S & (-S))

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long double ld;

#define open first
#define close second

int n, m;
int tree[400010];
int a[100010];
void build(int p = 1 , int s = 0, int e = n - 1){
	if (s == e){
		tree[p] = a[s];
		return;
	}
	build(2 * p, s, (s + e) / 2);
	build(2 * p + 1, (s + e) / 2 + 1, e);
	tree[p] = tree[p * 2] & tree[p * 2 + 1];
}
int query(int l, int r, int p = 1, int s = 0, int e = n - 1){
	if (s >=l && e <= r)return tree[p];
	if (e < l || s > r)return INF;
	return query(l, r, 2 * p, s, (s + e) / 2)&query(l, r, 2 * p + 1, (s + e) / 2 + 1, e);
}

int bit[31][100010];
pair<ii,int> q[100010];

int main(){
	fastIO;
	//read; write;
	cin >> n >> m;
	rep(i, m){
		cin >> q[i].first.first >> q[i].first.second >> q[i].second;
		q[i].first.first--; q[i].first.second--;
		rep(j, 31)if ((q[i].second & 1 << j) != 0) bit[j][q[i].first.first] += 1, bit[j][q[i].first.second + 1] -= 1;
	}
	rep(i, n)a[i] = 0;
	rep(i, 31){
		int c = 0;
		rep(j, n){
			c += bit[i][j];
			if (c) a[j] |= 1 << i;
		}
	}
	build();
	rep(i, m){
		if (q[i].second != query(q[i].first.first, q[i].first.second)){
			cout << "NO";
			return 0;
		}
	}
	cout << "YES\n";
	rep(i, n)cout << a[i] << " ";
	return 0;
}


#define  _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<map>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<stack>
#include<math.h>
#include<set>
#include<string>
#include<cstring>
#include<queue>
#include<complex>
#include<assert.h>
#include<math.h>
#include<memory.h>
#include<sstream>
#include<cstdio>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define repi(i,a,n) for(int i=a;i<n;i++)
#define INF (0x7fffffff)
#define mp make_pair
#define fastIO ios::sync_with_stdio(false)
#define read freopen("in.in","r",stdin)
#define write freopen("out.out","w",stdout)
#define scf(xx) scanf("%d",&xx)
#define All(a) a.begin(), a.end()
#define LSOne(S) (S & (-S))

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long double ld;

#define open first
#define close second

int n, m;
int tree[400010];
int a[100010];
void build(int p = 1 , int s = 0, int e = n - 1){
	if (s == e){
		tree[p] = a[s];
		return;
	}
	build(2 * p, s, (s + e) / 2);
	build(2 * p + 1, (s + e) / 2 + 1, e);
	tree[p] = tree[p * 2] & tree[p * 2 + 1];
}
int query(int l, int r, int p = 1, int s = 0, int e = n - 1){
	if (s >=l && e <= r)return tree[p];
	if (e < l || s > r)return INF;
	return query(l, r, 2 * p, s, (s + e) / 2)&query(l, r, 2 * p + 1, (s + e) / 2 + 1, e);
}

int bit[31][100010];
pair<ii,int> q[100010];

int main(){
	fastIO;
	//read; write;
	cin >> n >> m;
	rep(i, m){
		cin >> q[i].first.first >> q[i].first.second >> q[i].second;
		q[i].first.first--; q[i].first.second--;
		rep(j, 31)if ((q[i].second & 1 << j) == 0) bit[j][q[i].first.first] += 1, bit[j][q[i].first.second + 1] -= 1;
	}
	rep(i, n)a[i] = INF;
	rep(i, 31){
		int c = 0;
		rep(j, n){
			c += bit[i][j];
			if (c) a[j] -= 1 << i;
		}
	}
	build();
	rep(i, m){
		if (q[i].second != query(q[i].first.first, q[i].first.second)){
			cout << "NO";
			return 0;
		}
	}
	cout << "YES\n";
	rep(i, n)cout << a[i] << " ";
	return 0;
}


#define  _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<map>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<stack>
#include<math.h>
#include<set>
#include<string>
#include<cstring>
#include<queue>
#include<complex>
#include<assert.h>
#include<math.h>
#include<memory.h>
#include<sstream>
#include<cstdio>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define repi(i,a,n) for(int i=a;i<n;i++)
#define INF (0x7fffffff)
#define mp make_pair
#define fastIO ios::sync_with_stdio(false)
#define read freopen("in.in","r",stdin)
#define write freopen("out.out","w",stdout)
#define scf(xx) scanf("%d",&xx)
#define All(a) a.begin(), a.end()
#define LSOne(S) (S & (-S))

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long double ld;

#define open first
#define close second

int n, m;
int tree[400010];
int a[100010];
void build(int p = 1 , int s = 0, int e = n - 1){
	if (s == e){
		tree[p] = a[s];
		return;
	}
	build(2 * p, s, (s + e) / 2);
	build(2 * p + 1, (s + e) / 2 + 1, e);
	tree[p] = tree[p * 2] & tree[p * 2 + 1];
}
int query(int l, int r, int p = 1, int s = 0, int e = n - 1){
	if (s >=l && e <= r)return tree[p];
	if (e < l || s > r)return INF/2;
	return query(l, r, 2 * p, s, (s + e) / 2)&query(l, r, 2 * p + 1, (s + e) / 2 + 1, e);
}

int bit[31][100010];
pair<ii,int> q[100010];

int main(){
	fastIO;
	//read; write;
	cin >> n >> m;
	rep(i, m){
		cin >> q[i].first.first >> q[i].first.second >> q[i].second;
		rep(j, 30)if ((q[i].second & 1 << j)==0) bit[j][q[i].first.first - 1] += 1, bit[j][q[i].first.second ] -= 1;
	}
	rep(i, n)a[i] = INF/2;
	rep(i, 30){
		int c = 0;
		rep(j, n){
			c += bit[i][j];
			if (c) a[j] -= 1 << i;
		}
	}
	build();
	rep(i, m){
		if (q[i].second != query(q[i].first.first - 1, q[i].first.second - 1)){
			cout << "NO";
			return 0;
		}
	}
	cout << "YES\n";
	rep(i, n)cout << a[i] << " ";
	return 0;
}


#define  _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<map>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<stack>
#include<math.h>
#include<set>
#include<string>
#include<cstring>
#include<queue>
#include<complex>
#include<assert.h>
#include<math.h>
#include<memory.h>
#include<sstream>
#include<cstdio>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define repi(i,a,n) for(int i=a;i<n;i++)
#define INF (0x7fffffff)
#define mp make_pair
#define fastIO ios::sync_with_stdio(false)
#define read freopen("in.in","r",stdin)
#define write freopen("out.out","w",stdout)
#define scf(xx) scanf("%d",&xx)
#define All(a) a.begin(), a.end()
#define LSOne(S) (S & (-S))

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long double ld;

#define open first
#define close second

int n, m;
int tree[400010];
int a[100010];
void build(int p = 1 , int s = 0, int e = n - 1){
	if (s == e){
		tree[p] = a[s];
		return;
	}
	build(2 * p, s, (s + e) / 2);
	build(2 * p + 1, (s + e) / 2 + 1, e);
	tree[p] = tree[p * 2] & tree[p * 2 + 1];
}
int query(int l, int r, int p = 1, int s = 0, int e = n - 1){
	if (s >=l && e <= r)return tree[p];
	if (e < l || s > r)return INF/2;
	return query(l, r, 2 * p, s, (s + e) / 2)&query(l, r, 2 * p + 1, (s + e) / 2 + 1, e);
}

int bit[31][100010];
pair<ii,int> q[100010];

int main(){
	fastIO;
	//read; write;
	cin >> n >> m;
	rep(i, m){
		cin >> q[i].first.first >> q[i].first.second >> q[i].second;
		rep(j, 30)if ((q[i].second & 1 << j)==0) bit[j][q[i].first.first - 1] = 1, bit[j][q[i].first.second ] = -1;
	}
	rep(i, n)a[i] = INF/2;
	rep(i, 30){
		int c = 0;
		rep(j, n){
			c += bit[i][j];
			if (c) a[j] -= 1 << i;
		}
	}
	build();
	rep(i, m){
		if (q[i].second != query(q[i].first.first - 1, q[i].first.second - 1)){
			cout << "NO";
			return 0;
		}
	}
	cout << "YES\n";
	rep(i, n)cout << a[i] << " ";
	return 0;
}


#define  _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<map>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<stack>
#include<math.h>
#include<set>
#include<string>
#include<cstring>
#include<queue>
#include<complex>
#include<assert.h>
#include<math.h>
#include<memory.h>
#include<sstream>
#include<cstdio>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define repi(i,a,n) for(int i=a;i<n;i++)
#define INF (0x7fffffff)
#define mp make_pair
#define fastIO ios::sync_with_stdio(false)
#define read freopen("in.in","r",stdin)
#define write freopen("out.out","w",stdout)
#define scf(xx) scanf("%d",&xx)
#define All(a) a.begin(), a.end()
#define LSOne(S) (S & (-S))

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long double ld;

#define open first
#define close second

int n, m;
int tree[400010];
int a[100010];
void build(int p = 1 , int s = 0, int e = n - 1){
	if (s == e){
		tree[p] = a[s];
		return;
	}
	build(2 * p, s, (s + e) / 2);
	build(2 * p + 1, (s + e) / 2 + 1, e);
	tree[p] = tree[p * 2] & tree[p * 2 + 1];
}
int query(int l, int r, int p = 1, int s = 0, int e = n - 1){
	if (s >=l && e <= r)return tree[p];
	if (e < l || s > r)return INF;
	return query(l, r, 2 * p, s, (s + e) / 2)&query(l, r, 2 * p + 1, (s + e) / 2 + 1, e);
}

int bit[31][100010];
pair<ii,int> q[100010];

int main(){
	fastIO;
	//read; write;
	cin >> n >> m;
	rep(i, m){
		cin >> q[i].first.first >> q[i].first.second >> q[i].second;
		rep(j, 31)if (!(q[i].second & 1 << j)) bit[j][q[i].first.first] = 1, bit[j][q[i].first.second + 1] = -1;
	}
	rep(i, n)a[i] = INF;
	rep(i, 31){
		int c = 0;
		rep(j, n){
			c += bit[i][j];
			if (c) a[j] -= 1 << i;
		}
	}
	build();
	rep(i, m){
		if (q[i].second != query(q[i].first.first - 1, q[i].first.second - 1)){
			cout << "NO";
			return 0;
		}
	}
	cout << "YES\n";
	rep(i, n)cout << a[i] << " ";
	return 0;
}


#define  _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<map>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<stack>
#include<math.h>
#include<set>
#include<string>
#include<cstring>
#include<queue>
#include<complex>
#include<assert.h>
#include<math.h>
#include<memory.h>
#include<sstream>
#include<cstdio>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define repi(i,a,n) for(int i=a;i<n;i++)
#define INF (0x7fffffff)
#define mp make_pair
#define fastIO ios::sync_with_stdio(false)
#define read freopen("in.in","r",stdin)
#define write freopen("out.out","w",stdout)
#define scf(xx) scanf("%d",&xx)
#define All(a) a.begin(), a.end()
#define LSOne(S) (S & (-S))

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long double ld;

#define open first
#define close second

int n, m;
int tree[400010];
int a[100010];
void build(int p = 1 , int s = 0, int e = n - 1){
	if (s == e){
		tree[p] = a[s];
		return;
	}
	build(2 * p, s, (s + e) / 2);
	build(2 * p + 1, (s + e) / 2 + 1, e);
	tree[p] = tree[p * 2] & tree[p * 2 + 1];
}
int query(int l, int r, int p = 1, int s = 0, int e = n - 1){
	if (s >=l && e <= r)return tree[p];
	if (e < l || s > r)return INF/2;
	return query(l, r, 2 * p, s, (s + e) / 2)&query(l, r, 2 * p + 1, (s + e) / 2 + 1, e);
}

int bit[31][100010];
pair<ii,int> q[100010];

int main(){
	fastIO;
	//read; write;
	cin >> n >> m;
	rep(i, m){
		cin >> q[i].first.first >> q[i].first.second >> q[i].second;
		rep(j, 30)if (!(q[i].second & 1 << j)) bit[j][q[i].first.first] = 1, bit[j][q[i].first.second + 1] = -1;
	}
	rep(i, n)a[i] = INF/2;
	rep(i, 30){
		int c = 0;
		rep(j, n){
			c += bit[i][j];
			if (c) a[j] -= 1 << i;
		}
	}
	build();
	rep(i, m){
		if (q[i].second != query(q[i].first.first - 1, q[i].first.second - 1)){
			cout << "NO";
			return 0;
		}
	}
	cout << "YES\n";
	rep(i, n)cout << a[i] << " ";
	return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

int a[100005];
int b[31][100005];
int ans[31][100005];
int q[100005][3];
int tr[30][400005];
int sol[100005];
void build(int in, int v, int l, int r)
{
	if(l==r){
		tr[in][v]  = ans[in][l];
		return;
	}
	int mid = (l+r)/2;
	build(in,2*v,l,mid);
	build(in,2*v+1,mid+1,r);
	tr[in][v] = min(tr[in][2*v],tr[in][2*v+1]);
}
/*
if (l > r)
		return 0;
	if (l == tl && r == tr)
		return t[v];
	int tm = (tl + tr) / 2;
	return sum (v*2, tl, tm, l, min(r,tm))
		+ sum (v*2+1, tm+1, tr, max(l,tm+1), r);
*/
int query(int in, int v, int lo,int hi,int l,int r)
{
	if(lo>hi)return 11;
	if(l==lo && r==hi)return tr[in][v];
	int mid = (l+r)/2;
	int fir,sec;
	fir = query(in,2*v,lo,min(mid,hi),l,mid);
	sec = query(in,2*v+1,max(mid+1,lo),hi,mid+1,r);
	return min(fir,sec);
}
int po[55];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int i,j,x;
	po[0] = 1;
	for(j=1;j<=31;j++)po[j] = 2*po[j-1];
	for(i=0;i<m;i++)
	{
		scanf("%d%d%d",&q[i][0],&q[i][1],&q[i][2]);

		for(j=0;j<30;j++)
		{
		if( q[i][2] & po[j])
		{
		//	printf("%d bit from %d to %d\n",j,q[i][0],q[i][1]);
			b[j][q[i][0]-1]++;
			b[j][q[i][1]]--;
		}

		}
	}
	for(i=0;i<30;i++)
	{
		int pr = 0;
		for(j=0;j<=n;j++)
		{
			pr +=b[i][j];
			if(pr >0)ans[i][j] = 1;
		//	if(ans[i][j])printf("%d bit of %d number\n",i,j);
		}

	}
	//printf("solution are like\n");
	for(i=0;i<n;i++)
	{
		int cur = 0;
		for(j=0;j<30;j++)
		if(ans[j][i])cur+=1<<j;
		sol[i] = cur;
	//	printf("%d ",cur);
	}
	//printf("\n");
/*
	for(i=0;i<30;i++)
		build(i,1,0,n-1);

	if(n==100000){
	printf("build succes\n");
	for(i=0;i<n;i++)
		printf("%d ",sol[i]);
	printf("\n");
	return 0;
}
*/

	//return 0;
	int valid = 1;
	for(i=0;i<m;i++)
	{
		int x,y;
		x = q[i][0];
		y = q[i][1];
		x--;
		y--;
		int cur = 0;
		for(j=0;j<30;j++)
		{
			int res = query(j,1,x,y,0,n-1);
	//		printf("for %d bit ans is %d\n",j,res);
			if(res==1)cur+=po[j];
		}
	//	printf("query %d resulted %d\n",i+1,cur);
		if(cur!=q[i][2]){valid = 0;break;}

	}
	if(valid)
	{
		printf("YES\n");
		for(i=0;i<n;i++)
			printf("%d ",sol[i]);
		printf("\n");
	}
	else printf("NO\n");
	return 0;

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

int a[100005];
int b[31][100005];
int ans[31][100005];
int q[100005][3];
int tr[30][400005];
int sol[100005];
void build(int in, int v, int l, int r)
{
	if(l==r){
		tr[in][v]  = ans[in][l];
		return;
	}
	int mid = (l+r)/2;
	build(in,2*v,l,mid);
	build(in,2*v+1,mid+1,r);
	tr[in][v] = min(tr[in][2*v],tr[in][2*v+1]);
}
int query(int in, int v, int lo,int hi,int l,int r)
{
	if(lo>hi)return 11;
	if(l==lo && r==hi)return tr[in][v];
	int mid = (l+r)/2;
	int fir,sec;
	fir = query(in,2*v,lo,min(mid,hi),l,mid);
	sec = query(in,2*v+1,max(mid+1,lo),hi,mid+1,r);
	return min(fir,sec);
}
int po[55];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int i,j,x;
	po[0] = 1;
	for(j=1;j<=31;j++)po[j] = 2*po[j-1];
	for(i=0;i<m;i++)
	{
		scanf("%d%d%d",&q[i][0],&q[i][1],&q[i][2]);

		for(j=0;j<30;j++)
		{
		if( q[i][2] & po[j])
		{
		//	printf("%d bit from %d to %d\n",j,q[i][0],q[i][1]);
			b[j][q[i][0]]++;
			b[j][q[i][1]+1]--;
		}

		}
	}
	for(i=0;i<30;i++)
	{
		int pr = 0;
		for(j=0;j<=n;j++)
		{
			pr +=b[i][j];
			if(pr >0)ans[i][j] = 1;
		//	if(ans[i][j])printf("%d bit of %d number\n",i,j);
		}
		for(j=0;j<n;j++)
		ans[i][j] = ans[i][j+1];
	}
	//printf("solution are like\n");
	for(i=0;i<n;i++)
	{
		int cur = 0;
		for(j=0;j<30;j++)
		if(ans[j][i])cur+=1<<j;
		sol[i] = cur;
	//	printf("%d ",cur);
	}
	//printf("\n");

	for(i=0;i<30;i++)
		build(i,1,0,n-1);

	if(n==100000){
	printf("build succes\n");
	for(i=0;i<n;i++)
		printf("%d ",sol[i]);
	printf("\n");
	return 0;
}

	//return 0;
	int valid = 1;
	for(i=0;i<m;i++)
	{
		int x,y;
		x = q[i][0];
		y = q[i][1];
		x--;
		y--;
		int cur = 0;
		for(j=0;j<30;j++)
		{
			int res = query(j,1,x,y,0,n-1);
	//		printf("for %d bit ans is %d\n",j,res);
			if(res==1)cur+=po[j];
		}
	//	printf("query %d resulted %d\n",i+1,cur);
		if(cur!=q[i][2]){valid = 0;break;}

	}
	if(valid)
	{
		printf("YES\n");
		for(i=0;i<n;i++)
			printf("%d ",sol[i]);
		printf("\n");
	}
	else printf("NO\n");
	return 0;

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

int a[100005];
int b[31][100005];
int ans[31][100005];
int q[100005][3];
int tr[30][400005];
int sol[100005];
void build(int in, int v, int l, int r)
{
	if(l==r){
		tr[in][v]  = ans[in][l];
		return;
	}
	int mid = (l+r)/2;
	build(in,2*v,l,mid);
	build(in,2*v+1,mid+1,r);
	tr[in][v] = min(tr[in][2*v],tr[in][2*v+1]);
}
int query(int in, int v, int lo,int hi,int l,int r)
{
	if(lo>hi)return 11;
	if(l==lo && r==hi)return tr[in][v];
	int mid = (l+r)/2;
	int fir,sec;
	fir = query(in,2*v,lo,min(mid,hi),l,mid);
	sec = query(in,2*v+1,max(mid+1,lo),hi,mid+1,r);
	return min(fir,sec);
}
int po[55];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int i,j,x;
	po[0] = 1;
	for(j=1;j<=31;j++)po[j] = 2*po[j-1];
	for(i=0;i<m;i++)
	{
		scanf("%d%d%d",&q[i][0],&q[i][1],&q[i][2]);

		for(j=0;j<30;j++)
		{
		if( q[i][2] & po[j])
		{
		//	printf("%d bit from %d to %d\n",j,q[i][0],q[i][1]);
			b[j][q[i][0]]++;
			b[j][q[i][1]+1]--;
		}

		}
	}
	for(i=0;i<30;i++)
	{
		int pr = 0;
		for(j=0;j<=n;j++)
		{
			pr +=b[i][j];
			if(pr >0)ans[i][j] = 1;
		//	if(ans[i][j])printf("%d bit of %d number\n",i,j);
		}
		for(j=0;j<n;j++)
		ans[i][j] = ans[i][j+1];
	}
	//printf("solution are like\n");
	for(i=0;i<n;i++)
	{
		int cur = 0;
		for(j=0;j<30;j++)
		if(ans[j][i])cur+=1<<j;
		sol[i] = cur;
	//	printf("%d ",cur);
	}
	//printf("\n");

	for(i=0;i<30;i++)
		build(i,1,0,n-1);
	//printf("build succes\n");
	//return 0;
	int valid = 1;
	for(i=0;i<m;i++)
	{
		int x,y;
		x = q[i][0];
		y = q[i][1];
		x--;
		y--;
		int cur = 0;
		for(j=0;j<30;j++)
		{
			int res = query(j,1,x,y,0,n-1);
	//		printf("for %d bit ans is %d\n",j,res);
			if(res==1)cur+=po[j];
		}
	//	printf("query %d resulted %d\n",i+1,cur);
		if(cur!=q[i][2]){valid = 0;break;}

	}
	if(valid)
	{
		printf("YES\n");
		for(i=0;i<n;i++)
			printf("%d ",sol[i]);
		printf("\n");
	}
	else printf("NO\n");
	return 0;

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

int a[100005];
int b[31][100005];
int ans[31][100005];
int q[100005][3];
int tr[30][400005];
int sol[100005];
void build(int in, int v, int l, int r)
{
	if(l==r){
		tr[in][v]  = ans[in][l];
		return;
	}
	int mid = (l+r)/2;
	build(in,2*v,l,mid);
	build(in,2*v+1,mid+1,r);
	tr[in][v] = min(tr[in][2*v],tr[in][2*v+1]);
}
int query(int in, int v, int lo,int hi,int l,int r)
{
	if(lo>hi)return 11;
	if(l==lo && r==hi)return tr[in][v];
	int mid = (l+r)/2;
	int fir,sec;
	fir = query(in,2*v,lo,min(mid,hi),l,mid);
	sec = query(in,2*v+1,max(mid+1,lo),hi,mid+1,r);
	return min(fir,sec);
}
int po[55];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int i,j,x;
	po[0] = 1;
	for(j=1;j<=31;j++)po[j] = 2*po[j-1];
	for(i=0;i<m;i++)
	{
		scanf("%d%d%d",&q[i][0],&q[i][1],&q[i][2]);

		for(j=0;j<30;j++)
		{
		if( q[i][2] & po[j])
		{
		//	printf("%d bit from %d to %d\n",j,q[i][0],q[i][1]);
			b[j][q[i][0]]++;
			b[j][q[i][1]+1]--;
		}

		}
	}
	for(i=0;i<30;i++)
	{
		int pr = 0;
		for(j=0;j<=n;j++)
		{
			pr +=b[i][j];
			if(pr >0)ans[i][j] = 1;
		//	if(ans[i][j])printf("%d bit of %d number\n",i,j);
		}
		for(j=0;j<n;j++)
		ans[i][j] = ans[i][j+1];
	}
	//printf("solution are like\n");
	for(i=0;i<n;i++)
	{
		int cur = 0;
		for(j=0;j<30;j++)
		if(ans[j][i])cur+=1<<j;
		sol[i] = cur;
	//	printf("%d ",cur);
	}
	//printf("\n");

	for(i=0;i<30;i++)
		build(i,1,0,n-1);
	//printf("build succes\n");
	//return 0;
	int valid = 1;
	for(i=0;i<m;i++)
	{
		int x,y;
		x = q[i][0];
		y = q[i][1];
		x--;
		y--;
		int cur = 0;
		for(j=0;j<28;j++)
		{
			int res = query(j,1,x,y,0,n-1);
	//		printf("for %d bit ans is %d\n",j,res);
			if(res==1)cur+=po[j];
		}
	//	printf("query %d resulted %d\n",i+1,cur);
		if(cur!=q[i][2]){valid = 0;break;}

	}
	if(valid)
	{
		printf("YES\n");
		for(i=0;i<n;i++)
			printf("%d ",sol[i]);
		printf("\n");
	}
	else printf("NO\n");
	return 0;

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

int a[100005];
int b[31][100005];
int ans[31][100005];
int q[100005][3];
int tr[30][400005];
int sol[100005];
void build(int in, int v, int l, int r)
{
	if(l==r){
		tr[in][v]  = ans[in][l];
		return;
	}
	int mid = (l+r)/2;
	build(in,2*v,l,mid);
	build(in,2*v+1,mid+1,r);
	tr[in][v] = min(tr[in][2*v],tr[in][2*v+1]);
}
int query(int in, int v, int lo,int hi,int l,int r)
{
	if(lo>hi)return 11;
	if(l==lo && r==hi)return tr[in][v];
	int mid = (l+r)/2;
	int fir,sec;
	fir = query(in,2*v,lo,min(mid,hi),l,mid);
	sec = query(in,2*v+1,max(mid+1,lo),hi,mid+1,r);
	return min(fir,sec);
}
int po[55];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int i,j,x;
	po[0] = 1;
	for(j=1;j<=31;j++)po[j] = 2*po[j-1];
	for(i=0;i<m;i++)
	{
		scanf("%d%d%d",&q[i][0],&q[i][1],&q[i][2]);

		for(j=0;j<30;j++)
		{
		if( q[i][2] & po[j])
		{
		//	printf("%d bit from %d to %d\n",j,q[i][0],q[i][1]);
			b[j][q[i][0]]++;
			b[j][q[i][1]+1]--;
		}

		}
	}
	for(i=0;i<30;i++)
	{
		int pr = 0;
		for(j=0;j<=n;j++)
		{
			pr +=b[i][j];
			if(pr >0)ans[i][j] = 1;
		//	if(ans[i][j])printf("%d bit of %d number\n",i,j);
		}
		for(j=0;j<n;j++)
		ans[i][j] = ans[i][j+1];
	}
	//printf("solution are like\n");
	for(i=0;i<n;i++)
	{
		int cur = 0;
		for(j=0;j<30;j++)
		if(ans[j][i])cur+=1<<j;
		sol[i] = cur;
	//	printf("%d ",cur);
	}
	//printf("\n");

	for(i=0;i<30;i++)
		build(i,1,0,n-1);
	//printf("build succes\n");
	//return 0;
	int valid = 1;
	for(i=0;i<m;i++)
	{
		int x,y;
		x = q[i][0];
		y = q[i][1];
		x--;
		y--;
		int cur = 0;
		for(j=0;j<29;j++)
		{
			int res = query(j,1,x,y,0,n-1);
	//		printf("for %d bit ans is %d\n",j,res);
			if(res==1)cur+=po[j];
		}
	//	printf("query %d resulted %d\n",i+1,cur);
		if(cur!=q[i][2]){valid = 0;break;}

	}
	if(valid)
	{
		printf("YES\n");
		for(i=0;i<n;i++)
			printf("%d ",sol[i]);
		printf("\n");
	}
	else printf("NO\n");
	return 0;

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

int a[100005];
int b[31][100005];
int ans[31][100005];
int q[100005][3];
int tr[30][400005];
int sol[100005];
void build(int in, int v, int l, int r)
{
	if(l==r){
		tr[in][v]  = ans[in][l];
		return;
	}
	int mid = (l+r)/2;
	build(in,2*v,l,mid);
	build(in,2*v+1,mid+1,r);
	tr[in][v] = min(tr[in][2*v],tr[in][2*v+1]);
}
/*
if (l > r)
		return 0;
	if (l == tl && r == tr)
		return t[v];
	int tm = (tl + tr) / 2;
	return sum (v*2, tl, tm, l, min(r,tm))
		+ sum (v*2+1, tm+1, tr, max(l,tm+1), r);
*/
int query(int in, int v, int lo,int hi,int l,int r)
{
	if(lo>hi)return 11;
	if(l==lo && r==hi)return tr[in][v];
	int mid = (l+r)/2;
	int fir,sec;
	fir = query(in,2*v,lo,min(mid,hi),l,mid);
	sec = query(in,2*v+1,max(mid+1,lo),hi,mid+1,r);
	return min(fir,sec);
}
int po[55];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int i,j,x;
	po[0] = 1;
	for(j=1;j<=31;j++)po[j] = 2*po[j-1];
	for(i=0;i<m;i++)
	{
		scanf("%d%d%d",&q[i][0],&q[i][1],&q[i][2]);

		for(j=0;j<30;j++)
		{
		if( q[i][2] & po[j])
		{
		//	printf("%d bit from %d to %d\n",j,q[i][0],q[i][1]);
			b[j][q[i][0]]++;
			b[j][q[i][1]+1]--;
		}

		}
	}
	for(i=0;i<30;i++)
	{
		int pr = 0;
		for(j=0;j<=n;j++)
		{
			pr +=b[i][j];
			if(pr >0)ans[i][j] = 1;
		//	if(ans[i][j])printf("%d bit of %d number\n",i,j);
		}
		for(j=0;j<n;j++)
		ans[i][j] = ans[i][j+1];
	}
	//printf("solution are like\n");
	for(i=0;i<n;i++)
	{
		int cur = 0;
		for(j=0;j<30;j++)
		if(ans[j][i])cur+=1<<j;
		sol[i] = cur;
	//	printf("%d ",cur);
	}
	//printf("\n");
/*
	for(i=0;i<30;i++)
		build(i,1,0,n-1);

	if(n==100000){
	printf("build succes\n");
	for(i=0;i<n;i++)
		printf("%d ",sol[i]);
	printf("\n");
	return 0;
}
*/

	//return 0;
	int valid = 1;
	for(i=0;i<m;i++)
	{
		int x,y;
		x = q[i][0];
		y = q[i][1];
		x--;
		y--;
		int cur = 0;
		for(j=0;j<25;j++)
		{
			int res = query(j,1,x,y,0,n-1);
	//		printf("for %d bit ans is %d\n",j,res);
			if(res==1)cur+=po[j];
		}
	//	printf("query %d resulted %d\n",i+1,cur);
		if(cur!=q[i][2]){valid = 0;break;}

	}
	if(valid)
	{
		printf("YES\n");
		for(i=0;i<n;i++)
			printf("%d ",sol[i]);
		printf("\n");
	}
	else printf("NO\n");
	return 0;

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

int a[100005];
int b[31][100005];
int ans[31][100005];
int q[100005][3];
int tr[30][400005];
int sol[100005];
void build(int in, int v, int l, int r)
{
	if(l==r){
		tr[in][v]  = ans[in][l];
		return;
	}
	int mid = (l+r)/2;
	build(in,2*v,l,mid);
	build(in,2*v+1,mid+1,r);
	tr[in][v] = min(tr[in][2*v],tr[in][2*v+1]);
}
int query(int in, int v, int lo,int hi,int l,int r)
{
	if(lo>hi)return 11;
	if(l==lo && r==hi)return tr[in][v];
	int mid = (l+r)/2;
	int fir,sec;
	fir = query(in,2*v,lo,min(mid,hi),l,mid);
	sec = query(in,2*v+1,max(mid+1,lo),hi,mid+1,r);
	return min(fir,sec);
}
int po[55];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int i,j,x;
	po[0] = 1;
	for(j=1;j<=31;j++)po[j] = 2*po[j-1];
	for(i=0;i<m;i++)
	{
		scanf("%d%d%d",&q[i][0],&q[i][1],&q[i][2]);
q[i][0]--;
q[i][1]--;

		for(j=0;j<30;j++)
		{
		if( q[i][2] & po[j])
		{
		//	printf("%d bit from %d to %d\n",j,q[i][0],q[i][1]);
			b[j][q[i][0]]++;
			b[j][q[i][1]+1]--;
		}

		}
	}
	for(i=0;i<30;i++)
	{
		int pr = 0;
		for(j=0;j<=n;j++)
		{
			pr +=b[i][j];
			if(pr >0)ans[i][j] = 1;
		//	if(ans[i][j])printf("%d bit of %d number\n",i,j);
		}

	}
	//printf("solution are like\n");
	for(i=0;i<n;i++)
	{
		int cur = 0;
		for(j=0;j<30;j++)
		if(ans[j][i])cur+=1<<j;
		sol[i] = cur;
	//	printf("%d ",cur);
	}
	//printf("\n");

	for(i=0;i<30;i++)
		build(i,1,0,n-1);
	//printf("build succes\n");
	//return 0;
	int valid = 1;
	for(i=0;i<m;i++)
	{
		int x,y;
		x = q[i][0];
		y = q[i][1];
		//x--;
		//y--;
		int cur = 0;
		for(j=0;j<30;j++)
		{
			int res = query(j,1,x,y,0,n-1);
	//		printf("for %d bit ans is %d\n",j,res);
			if(res==1)cur+=po[j];
		}
	//	printf("query %d resulted %d\n",i+1,cur);
		if(cur!=q[i][2]){valid = 0;break;}

	}
	if(valid)
	{
		printf("YES\n");
		for(i=0;i<n;i++)
			printf("%d ",sol[i]);
		printf("\n");
	}
	else printf("NO\n");
	return 0;

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

int a[100005];
int b[31][100005];
int ans[31][100005];
int q[100005][3];
int tr[30][400005];
int sol[100005];
void build(int in, int v, int l, int r)
{
	if(l==r){
		tr[in][v]  = ans[in][l];
		return;
	}
	int mid = (l+r)/2;
	build(in,2*v,l,mid);
	build(in,2*v+1,mid+1,r);
	tr[in][v] = min(tr[in][2*v],tr[in][2*v+1]);
}
/*
if (l > r)
		return 0;
	if (l == tl && r == tr)
		return t[v];
	int tm = (tl + tr) / 2;
	return sum (v*2, tl, tm, l, min(r,tm))
		+ sum (v*2+1, tm+1, tr, max(l,tm+1), r);
*/
int query(int in, int v, int lo,int hi,int l,int r)
{
	if(lo>hi)return 11;
	if(l==lo && r==hi)return tr[in][v];
	int mid = (l+r)/2;
	int fir,sec;
	fir = query(in,2*v,lo,min(mid,hi),l,mid);
	sec = query(in,2*v+1,max(mid+1,lo),hi,mid+1,r);
	return min(fir,sec);
}
int po[55];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int i,j,x;
	po[0] = 1;
	for(j=1;j<=31;j++)po[j] = 2*po[j-1];
	for(i=0;i<m;i++)
	{
		scanf("%d%d%d",&q[i][0],&q[i][1],&q[i][2]);

		for(j=0;j<30;j++)
		{
		if( q[i][2] & po[j])
		{
		//	printf("%d bit from %d to %d\n",j,q[i][0],q[i][1]);
			b[j][q[i][0]]++;
			b[j][q[i][1]+1]--;
		}

		}
	}
	for(i=0;i<30;i++)
	{
		int pr = 0;
		for(j=0;j<=n;j++)
		{
			pr +=b[i][j];
			if(pr >0)ans[i][j] = 1;
		//	if(ans[i][j])printf("%d bit of %d number\n",i,j);
		}
		for(j=0;j<n;j++)
		ans[i][j] = ans[i][j+1];
	}
	//printf("solution are like\n");
	for(i=0;i<n;i++)
	{
		int cur = 0;
		for(j=0;j<30;j++)
		if(ans[j][i])cur+=1<<j;
		sol[i] = cur;
	//	printf("%d ",cur);
	}
	//printf("\n");
/*
	for(i=0;i<30;i++)
		build(i,1,0,n-1);

	if(n==100000){
	printf("build succes\n");
	for(i=0;i<n;i++)
		printf("%d ",sol[i]);
	printf("\n");
	return 0;
}
*/

	//return 0;
	int valid = 1;
	for(i=0;i<m;i++)
	{
		int x,y;
		x = q[i][0];
		y = q[i][1];
		x--;
		y--;
		int cur = 0;
		for(j=0;j<250;j++)
		{
			int res = query(j,1,x,y,0,n-1);
	//		printf("for %d bit ans is %d\n",j,res);
			if(res==1)cur+=po[j];
		}
	//	printf("query %d resulted %d\n",i+1,cur);
		if(cur!=q[i][2]){valid = 0;break;}

	}
	if(valid)
	{
		printf("YES\n");
		for(i=0;i<n;i++)
			printf("%d ",sol[i]);
		printf("\n");
	}
	else printf("NO\n");
	return 0;

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

int a[100005];
int b[31][100005];
int ans[31][100005];
int q[100005][3];
int tr[30][400005];
int sol[100005];
void build(int in, int v, int l, int r)
{
	if(l==r){
		tr[in][v]  = ans[in][l];
		return;
	}
	int mid = (l+r)/2;
	build(in,2*v,l,mid);
	build(in,2*v+1,mid+1,r);
	tr[in][v] = min(tr[in][2*v],tr[in][2*v+1]);
}
int query(int in, int v, int lo,int hi,int l,int r)
{
	if(lo>hi)return 11;
	if(l==lo && r==hi)return tr[in][v];
	int mid = (l+r)/2;
	int fir,sec;
	fir = query(in,2*v,lo,min(mid,hi),l,mid);
	sec = query(in,2*v+1,max(mid+1,lo),hi,mid+1,r);
	return min(fir,sec);
}
int po[55];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int i,j,x;
	po[0] = 1;
	for(j=1;j<=31;j++)po[j] = 2*po[j-1];
	for(i=0;i<m;i++)
	{
		scanf("%d%d%d",&q[i][0],&q[i][1],&q[i][2]);

		for(j=0;j<30;j++)
		{
		if( q[i][2] & po[j])
		{
		//	printf("%d bit from %d to %d\n",j,q[i][0],q[i][1]);
			b[j][q[i][0]]++;
			b[j][q[i][1]+1]--;
		}

		}
	}
	for(i=0;i<30;i++)
	{
		int pr = 0;
		for(j=0;j<=n;j++)
		{
			pr +=b[i][j];
			if(pr >0)ans[i][j] = 1;
		//	if(ans[i][j])printf("%d bit of %d number\n",i,j);
		}
		for(j=0;j<n;j++)
		ans[i][j] = ans[i][j+1];
	}
	//printf("solution are like\n");
	for(i=0;i<n;i++)
	{
		int cur = 0;
		for(j=0;j<30;j++)
		if(ans[j][i])cur+=1<<j;
		sol[i] = cur;
	//	printf("%d ",cur);
	}
	//printf("\n");

	for(i=0;i<30;i++)
		build(i,1,0,n-1);
	//printf("build succes\n");
	//return 0;
	int valid = 1;
	for(i=0;i<m;i++)
	{
		int x,y;
		x = q[i][0];
		y = q[i][1];
		x--;
		y--;
		int cur = 0;
		for(j=0;j<25;j++)
		{
			int res = query(j,1,x,y,0,n-1);
	//		printf("for %d bit ans is %d\n",j,res);
			if(res==1)cur+=po[j];
		}
	//	printf("query %d resulted %d\n",i+1,cur);
		if(cur!=q[i][2]){valid = 0;break;}

	}
	if(valid)
	{
		printf("YES\n");
		for(i=0;i<n;i++)
			printf("%d ",sol[i]);
		printf("\n");
	}
	else printf("NO\n");
	return 0;

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

int a[100005];
int b[31][100005];
int ans[31][100005];
int q[100005][3];
int tr[30][400005];
int sol[100005];
void build(int in, int v, int l, int r)
{
	if(l==r){
		tr[in][v]  = ans[in][l];
		return;
	}
	int mid = (l+r)/2;
	build(in,2*v,l,mid);
	build(in,2*v+1,mid+1,r);
	tr[in][v] = min(tr[in][2*v],tr[in][2*v+1]);
}
int query(int in, int v, int lo,int hi,int l,int r)
{
	if(lo>hi)return 11;
	if(l==lo && r==hi)return tr[in][v];
	int mid = (l+r)/2;
	int fir,sec;
	fir = query(in,2*v,lo,min(mid,hi),l,mid);
	sec = query(in,2*v+1,max(mid+1,lo),hi,mid+1,r);
	return min(fir,sec);
}
int po[55];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int i,j,x;
	po[0] = 1;
	for(j=1;j<=31;j++)po[j] = 2*po[j-1];
	for(i=0;i<m;i++)
	{
		scanf("%d%d%d",&q[i][0],&q[i][1],&q[i][2]);

		for(j=0;j<30;j++)
		{
		if( q[i][2] & po[j])
		{
		//	printf("%d bit from %d to %d\n",j,q[i][0],q[i][1]);
			b[j][q[i][0]]++;
			b[j][q[i][1]+1]--;
		}

		}
	}
	for(i=0;i<30;i++)
	{
		int pr = 0;
		for(j=0;j<=n;j++)
		{
			pr +=b[i][j];
			if(pr >0)ans[i][j] = 1;
		//	if(ans[i][j])printf("%d bit of %d number\n",i,j);
		}
		for(j=0;j<n;j++)
		ans[i][j] = ans[i][j+1];
	}
	//printf("solution are like\n");
	for(i=0;i<n;i++)
	{
		int cur = 0;
		for(j=0;j<30;j++)
		if(ans[j][i])cur+=1<<j;
		sol[i] = cur;
	//	printf("%d ",cur);
	}
	//printf("\n");

	for(i=0;i<30;i++)
		build(i,1,0,n-1);
	/*
	if(n==100000){
	printf("build succes\n");
	for(i=0;i<n;i++)
		printf("%d ",sol[i]);
	printf("\n");
	return 0;
}
*/
	//return 0;
	int valid = 1;
	for(i=0;i<m;i++)
	{
		int x,y;
		x = q[i][0];
		y = q[i][1];
		x--;
		y--;
		int cur = 0;
		for(j=0;j<30;j++)
		{
			int res = query(j,1,x,y,0,n-1);
	//		printf("for %d bit ans is %d\n",j,res);
			if(res==1)cur+=po[j];
		}
	//	printf("query %d resulted %d\n",i+1,cur);
		if(cur!=q[i][2]){break;valid = 0;}

	}
	if(valid)
	{
		printf("YES\n");
		for(i=0;i<n;i++)
			printf("%d ",sol[i]);
		printf("\n");
	}
	else printf("NO\n");
	return 0;

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

int a[100005];
int b[31][100005];
int ans[31][100005];
int q[100005][3];
int tr[30][400005];
int sol[100005];
void build(int in, int v, int l, int r)
{
	if(l==r){
		tr[in][v]  = ans[in][l];
		return;
	}
	int mid = (l+r)/2;
	build(in,2*v,l,mid);
	build(in,2*v+1,mid+1,r);
	tr[in][v] = min(tr[in][2*v],tr[in][2*v+1]);
}
int query(int in, int v, int lo,int hi,int l,int r)
{
	if(lo>hi)return 11;
	if(l==lo && r==hi)return tr[in][v];
	int mid = (l+r)/2;
	int fir,sec;
	fir = query(in,2*v,lo,min(mid,hi),l,mid);
	sec = query(in,2*v+1,max(mid+1,lo),hi,mid+1,r);
	return min(fir,sec);
}
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int i,j,x;
	for(i=0;i<m;i++)
	{
		scanf("%d%d%d",&q[i][0],&q[i][1],&q[i][2]);
		int pr = 1;
		for(j=0;j<31;j++)
		{
		if( q[i][2] & pr)
		{
		//	printf("%d bit from %d to %d\n",j,q[i][0],q[i][1]);
			b[j][q[i][0]]++;
			b[j][q[i][1]+1]--;
		}
		pr = pr*2;
		}
	}
	for(i=0;i<30;i++)
	{
		int pr = 0;
		for(j=0;j<=n;j++)
		{
			pr +=b[i][j];
			if(pr >0)ans[i][j] = 1;
		//	if(ans[i][j])printf("%d bit of %d number\n",i,j);
		}
		for(j=0;j<n;j++)
		ans[i][j] = ans[i][j+1];
	}
	//printf("solution are like\n");
	for(i=0;i<n;i++)
	{
		int cur = 0;
		for(j=0;j<30;j++)
		if(ans[j][i])cur+=1<<j;
		sol[i] = cur;
	//	printf("%d ",cur);
	}
	//printf("\n");

	for(i=0;i<30;i++)
		build(i,1,0,n-1);
	//printf("build succes\n");
	//return 0;
	int valid = 1;
	for(i=0;i<m;i++)
	{
		int x,y;
		x = q[i][0];
		y = q[i][1];
		x--;
		y--;
		int cur = 0;
		for(j=0;j<30;j++)
		{
			int res = query(j,1,x,y,0,n-1);
	//		printf("for %d bit ans is %d\n",j,res);
			if(res==1)cur+=(1<<j);
		}
	//	printf("query %d resulted %d\n",i+1,cur);
		if(cur!=q[i][2])valid = 0;

	}
	if(valid)
	{
		printf("YES\n");
		for(i=0;i<n;i++)
			printf("%d ",sol[i]);
		printf("\n");
	}
	else printf("NO\n");
	return 0;

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

int a[100005];
int b[31][100005];
int ans[31][100005];
int q[100005][3];
int tr[30][400005];
int sol[100005];
void build(int in, int v, int l, int r)
{
	if(l==r){
		tr[in][v]  = ans[in][l];
		return;
	}
	int mid = (l+r)/2;
	build(in,2*v,l,mid);
	build(in,2*v+1,mid+1,r);
	tr[in][v] = min(tr[in][2*v],tr[in][2*v+1]);
}
int query(int in, int v, int lo,int hi,int l,int r)
{
	if(lo>hi)return 11;
	if(l==lo && r==hi)return tr[in][v];
	int mid = (l+r)/2;
	int fir,sec;
	fir = query(in,2*v,lo,min(mid,hi),l,mid);
	sec = query(in,2*v+1,max(mid+1,lo),hi,mid+1,r);
	return min(fir,sec);
}
int po[55];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int i,j,x;
	po[0] = 1;
	for(j=1;j<=31;j++)po[j] = 2*po[j-1];
	for(i=0;i<m;i++)
	{
		scanf("%d%d%d",&q[i][0],&q[i][1],&q[i][2]);

		for(j=0;j<30;j++)
		{
		if( q[i][2] & po[j])
		{
		//	printf("%d bit from %d to %d\n",j,q[i][0],q[i][1]);
			b[j][q[i][0]]++;
			b[j][q[i][1]+1]--;
		}

		}
	}
	for(i=0;i<30;i++)
	{
		int pr = 0;
		for(j=0;j<=n;j++)
		{
			pr +=b[i][j];
			if(pr >0)ans[i][j] = 1;
		//	if(ans[i][j])printf("%d bit of %d number\n",i,j);
		}
		for(j=0;j<n;j++)
		ans[i][j] = ans[i][j+1];
	}
	//printf("solution are like\n");
	for(i=0;i<n;i++)
	{
		int cur = 0;
		for(j=0;j<30;j++)
		if(ans[j][i])cur+=1<<j;
		sol[i] = cur;
	//	printf("%d ",cur);
	}
	//printf("\n");

	for(i=0;i<30;i++)
		build(i,1,0,n-1);
	//printf("build succes\n");
	//return 0;
	int valid = 1;
	for(i=0;i<m;i++)
	{
		int x,y;
		x = q[i][0];
		y = q[i][1];
		x--;
		y--;
		int cur = 0;
		for(j=0;j<30;j++)
		{
			int res = query(j,1,x,y,0,n-1);
	//		printf("for %d bit ans is %d\n",j,res);
			if(res==1)cur+=po[j];
		}
	//	printf("query %d resulted %d\n",i+1,cur);
		if(cur!=q[i][2])valid = 0;

	}
	if(valid)
	{
		printf("YES\n");
		for(i=0;i<n;i++)
			printf("%d ",sol[i]);
		printf("\n");
	}
	else printf("NO\n");
	return 0;

}


#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

int a[100005];
int b[31][100005];
int ans[31][100005];
int q[100005][3];
int tr[30][400005];
int sol[100005];
void build(int in, int v, int l, int r)
{
	if(l==r){
		tr[in][v]  = ans[in][l];
		return;
	}
	int mid = (l+r)/2;
	build(in,2*v,l,mid);
	build(in,2*v+1,mid+1,r);
	tr[in][v] = min(tr[in][2*v],tr[in][2*v+1]);
}
int query(int in, int v, int lo,int hi,int l,int r)
{
	if(lo>hi)return 11;
	if(l==lo && r==hi)return tr[in][v];
	int mid = (l+r)/2;
	int fir,sec;
	fir = query(in,2*v,lo,min(mid,hi),l,mid);
	sec = query(in,2*v+1,max(mid+1,lo),hi,mid+1,r);
	return min(fir,sec);
}
int po[55];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int i,j,x;
	po[0] = 1;
	for(j=1;j<=31;j++)po[j] = 2*po[j-1];
	for(i=0;i<m;i++)
	{
		scanf("%d%d%d",&q[i][0],&q[i][1],&q[i][2]);

		for(j=0;j<30;j++)
		{
		if( q[i][2] & po[j])
		{
		//	printf("%d bit from %d to %d\n",j,q[i][0],q[i][1]);
			b[j][q[i][0]]++;
			b[j][q[i][1]+1]--;
		}

		}
	}
	for(i=0;i<30;i++)
	{
		int pr = 0;
		for(j=0;j<=n;j++)
		{
			pr +=b[i][j];
			if(pr >0)ans[i][j] = 1;
		//	if(ans[i][j])printf("%d bit of %d number\n",i,j);
		}
		for(j=0;j<n;j++)
		ans[i][j] = ans[i][j+1];
	}
	//printf("solution are like\n");
	for(i=0;i<n;i++)
	{
		int cur = 0;
		for(j=0;j<30;j++)
		if(ans[j][i])cur+=1<<j;
		sol[i] = cur;
	//	printf("%d ",cur);
	}
	//printf("\n");

	for(i=0;i<30;i++)
		build(i,1,0,n-1);
	if(n==100000){
	printf("build succes\n");
	for(i=0;i<n;i++)
		printf("%d ",sol[i]);
	printf("\n");
	return 0;
}
	//return 0;
	int valid = 1;
	for(i=0;i<m;i++)
	{
		int x,y;
		x = q[i][0];
		y = q[i][1];
		x--;
		y--;
		int cur = 0;
		for(j=0;j<30;j++)
		{
			int res = query(j,1,x,y,0,n-1);
	//		printf("for %d bit ans is %d\n",j,res);
			if(res==1)cur+=po[j];
		}
	//	printf("query %d resulted %d\n",i+1,cur);
		if(cur!=q[i][2]){break;valid = 0;}

	}
	if(valid)
	{
		printf("YES\n");
		for(i=0;i<n;i++)
			printf("%d ",sol[i]);
		printf("\n");
	}
	else printf("NO\n");
	return 0;

}


#include<iostream>
#include<cstdio>
#include<vector>
#include<set>
#include<algorithm>
#define pb push_back
#define mp make_pair
using namespace std;
main()
{
    int i,j,k,n,m,x,y,val,start,fin,cnt,t;
    cin>>n>>m;
    int a[n+1],next[n+1];
    fill(a,a+n+1,0);
    for(i=0;i<=n;i++) next[i]=i+1;
    vector<pair<int,pair<int,int> > > v;
    for(i=0;i<m;i++)
    {
        scanf("%d %d %d",&x,&y,&val);
        v.pb(mp(val,mp(x,y)));
    }
    sort(v.begin(),v.end());
    for(i=v.size()-1;i>=0;i--)
    {
        start=v[i].second.first;
        fin=v[i].second.second;
        start--;
        fin--;
        val=v[i].first;
        cnt=0;
        while(start<=fin&&start<n)
        {
            if(a[start]<val)
            {
                a[start]=val;
                t=next[start];
                next[start]=next[fin];
                cnt++;
                start++;
            }
            else if(a[start]==val)
            {
                cnt++;
                start=next[start];
            }
            else
            {
                if((val&a[start])!=val)
                {
                    cout<<"NO";
                    return 0;
                }
                start=next[start];
            }
        }
        if(cnt==0)
        {
            cout<<"NO";
            return 0;
        }
    }
    cout<<"YES"<<endl;
    for(i=0;i<n;i++) cout<<a[i]<<" ";
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<set>
#include<algorithm>
#define pb push_back
#define mp make_pair
#define M 2000000
using namespace std;

int a[M];

struct
{
    int from,to,ans;
}tree[M];

void make_a_tree(int left,int right,int node)
{
    tree[node].from=left;
    tree[node].to=right;
    if(left==right)
    {
        tree[node].ans=a[left];
        return ;
    }
    int div;
    div=(left+right)/2;
    make_a_tree(left,div,node+node);
    make_a_tree(div+1,right,node+node+1);
    tree[node].ans=tree[node+node].ans&tree[node+node+1].ans;
    return ;
}

int query(int left,int right,int node)
{
    if(tree[node].from==left&&tree[node].to==right)
    {
        return tree[node].ans;
    }
    int div;
    int ans1,ans2;
    div=(tree[node].from+tree[node].to)/2;
    if(right<=div)
    {
        return query(left,right,node+node);
    }
    else if(left>div)
    {
        return query(left,right,node+node+1);
    }
    else
    {
        ans1=query(left,div,node+node);
        ans2=query(div+1,right,node+node+1);
        return ans1&ans2;
    }
}

main()
{
    int i,j,k,n,m,x,y,val,start,fin,cnt,t,par;
    cin>>n>>m;
    int next[n+1];
    fill(a,a+n+1,0);
    for(i=0;i<=n;i++) next[i]=i+1;
    vector<pair<int,pair<int,int> > > v;
    for(i=0;i<m;i++)
    {
        scanf("%d %d %d",&x,&y,&val);
        v.pb(mp(val,mp(x,y)));
    }
    sort(v.begin(),v.end());
    for(i=v.size()-1;i>=0;i--)
    {
        start=v[i].second.first;
        fin=v[i].second.second;
        start--;
        fin--;
        val=v[i].first;
        while(start<=fin&&start<n)
        {
            if(a[start]<val)
            {
                a[start]=val;
                t=next[start];
                next[start]=next[fin];
                start++;
            }
            else if(a[start]==val)
            {
                start=next[start];
            }
            else
            {
                start=next[start];
            }
        }
    }

    make_a_tree(0,n-1,1);

    for(i=0;i<v.size();i++)
    {
        par=query(v[i].second.first-1,v[i].second.second-1,1);
        if(par!=v[i].first)
        {
            cout<<"NO";
            return 0;
        }
    }

    cout<<"YES"<<endl;
    for(i=0;i<n;i++) cout<<a[i]<<" ";
}