#include <bits/stdc++.h>
using namespace std;
int n,x,y,ans = 1e9;
int h[101];
int main()
{
	cin >> n >> h[1];
	for (int i = 2;i <= n;i++)
	{
	    cin >> h[i];
		if (abs (h[i] - h[i - 1]) < ans)
		    ans = abs (h[i] - h[i - 1]),x = i - 1,y = i;
	}
	if (abs (h[1] - h[n]) < ans)
	    cout << n << " " << 1;
	else
	    cout << x << " " << y;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{

    int n;

    cin >> n;

    int s[n+2];

    for (int i = 1; i <= n; ++i)
    {
    	cin >> s[i];
	}

	int minn = abs(s[n] - s[1]);
	int s1 = n, s2 = 1;

	for (int i = 1; i < n; ++i)
	{
		int l;
		l = abs(s[i] - s[i+1]);
		if (l < minn)
		{
			minn = l;
			s1 = i, s2 = i+1;
		}
	}

	cout << s1 << " " << s2;

    return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,Min,M_i;
int a[1000010];
signed main()
{
	cin>>n;
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
	Min=abs(a[n]-a[1]);
	M_i=n;
	for(int i=1;i<n;i++)if(abs(a[i]-a[i+1])<=Min)Min=abs(a[i]-a[i+1]),M_i=i;
	if(M_i<n)cout<<M_i<<" "<<M_i+1;
	  else cout<<n<<" "<<1;
	return 0;
}


#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    int n, temp = 10000000000;
    cin >> n;
    int nums[n], a, b;
    for(int i = 0; i <= n - 1; i++)
    {
        cin >> nums[i];
    }
    for(int i = 0; i <= n - 1; i++)
    {
        for(int j = 0; j <= n - 1; j++)
        {
            if(i != j && abs(nums[i] - nums[j]) < temp)
            {
                temp = abs(nums[i] - nums[j]);
                a = i + 1;
                b = j + 1;
            }
        }
    }
    cout << a << " " << b << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[101],n;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
		cin>>a[i];
    for(int i=0;i<n;i++)
    {
    	if(minn>abs(a[i%n+1]-a[(i+1)%n+1]))
        {
            minn=abs(a[i%n+1]-a[(i+1)%n+1]);
            minx=i%n+1;
            miny=(i+1)%n+1;
        }
	}
    cout<<minx<<" "<<miny<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,a[210],tx,ty;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i],a[n+i]=a[i];
	int Min=1000000;
	for(int i=2;i<=n+1;i++)
		if(abs(a[i]-a[i-1])<Min)
			{
				Min=abs(a[i]-a[i-1]);
				if(i==n+1) tx=1,ty=n;
				else tx=i-1,ty=i;
			}
	cout<<tx<<" "<<ty;
	return 0;
}


#include <iostream>
#include <climits>
#include <cmath>
using namespace std;
int a[110];
int main()
{
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	int r =  a[1];
	for(int i = 1; i < n; i++) {
		a[i] = abs(a[i] - a[i + 1]);
	}
	a[n] = abs(a[n] - r);
//	for(int i = 1; i <= n; i++) {
//		cout << a[i] << " ";
//	}
//	cout << endl;
	int ansx = a[n], x = n, y = 1;
	for(int i = 2; i <= n; i++) {
		if(a[i] < ansx) {
			ansx = a[i];
			x = i;
			y = i + 1;
		}
	}
	cout << x << " " << y;
	return 0;
}


#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int a,ans=1100,q1,q2;
	cin>>a;
	int m[110];
	for(int i=1; i<=a; i++) cin>>m[i];
	for (int i=1; i<=a; i++)
		for (int j=i+1; j<=a; j++)
			if (abs(m[i]-m[j])<ans)
			{
				ans=abs(m[i]-m[j]);
				q1=i;
				q2=j;
			}
	cout<<q1<<' '<<q2<<'\n';
	return 0;
}


#include<iostream>
#include<cmath>
using namespace std;
int ans=10001,l,r;
int main()
{
    int k,n,m,j;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>k;
        if(i==1)m=k;
        else if(ans>abs(k-j))
        {
            l=i-1;
            r=i;
            ans=abs(k-j);
        }
        j=k;
    }
    if(ans>abs(k-m))
        l=n,r=1;
    cout<<l<<" "<<r<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a[1001],b,c,d=1,i;
	cin>>n;
	c=n;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	b=max(a[1],a[n])-min(a[1],a[n]);
	for(i=2;i<=n;i++)
	{
		if(max(a[i],a[i-1])-min(a[i],a[i-1])<b)
		{
			c=i-1;
			d=i;
		}
	}
	cout<<c<<" "<<d;
	return 0;
}


#include<iostream>
#include<cmath>
using namespace std;
int n,m,a[500001],order=10145,x,y,k;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	cin>>a[i];
	for(int i=2;i<=n;i++)
	{
		if(order>abs(a[i]-a[i-1]))
		{
			x=i-1;
			y=i;
			order=abs(a[i]-a[i-1]);
		}
    }
    if(order>abs(a[1]-a[n]))
    {
    	cout<<1<<" "<<n<<endl;
    	return 0;
	}
	cout<<x<<" "<<y<<endl;
}


#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int a,qq,qq1,mmin=999999999,temp;
	cin>>a;
	int m[a+10];
	for (int i=1; i<=a; i++) cin>>m[i];
	for(int i=1; i<=a; i++)
		for (int j=i+1; j<=a; j++)
		{
			if (max(m[i],m[j])-min(m[i],m[j])<mmin)
			{
				mmin=max(m[i],m[j])-min(m[i],m[j]);
				qq=i;
				qq1=j;
			}
		}
		cout<<qq<<" "<<qq1;
	return 0;
}


#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<iostream>
#include<queue>
#include<algorithm>
#include<stack>
int n,x,y,lll,ans;
int h[105];
int cha[105];
using namespace std;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>h[i];
	}
	if(n==2)
	{
		for(int i=1;i<=n;i++)
		{
			cout<<i<<" "<<i+1;
			return 0;
		}
	}
	else if(n!=2)
	{
		lll=abs(h[n]-h[1]);
		for(int i=1;i<n;i++)
		{
	    	if/*(lll==min(abs(h[i+1]-h[i]),lll))*/(abs(h[i+1]-h[i])>lll)
	    	{
	    		cout<<n<<" "<<"1"<<endl;
	    		return 0;
	    	}
	    	//if/*((abs(h[i+1]-h[i]))==min(abs(h[i+1]-h[i]),lll))*/(abs(h[i+1]-h[i])<lll)
	    	//{

	    	//	return 0;
	    	//}
			cout<<i<<" "<<i+1<<endl;
			return 0;
		}

		return 0;
	}
	return 0;
}


#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main(){
	int n,minn=100000,h[10000+10],p,x,y,i;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>h[i];
	}
	h[n]=h[0];
	for(i=0;i<n;i++){
		p=minn;
		if(h[i]>=h[i+1])
		minn=min(h[i]-h[i+1],minn);
		if(h[i+1]>h[i])
		minn=min(h[i+1]-h[i],minn);
		if(minn!=p){
		x=i+1;
		y=i+2;
		if(y==n+1)
		y=1;
		}
	}
	cout<<x<<" "<<y;
return 0;
}


// luogu-judger-enable-o2
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
int a[1000006];
int main()
{
	int n;
	cin>>n;
	int x,y;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	x=1;
	y=2;
	int ans=abs(a[1]-a[2]);
	for(int i=2;i<=n-1;i++)
	{
		if(abs(a[i]-a[i+1])<ans)
		{
			x=i;
			y=i+1;
		}
	}
	if(abs(a[1]-a[n])<ans)
	{
		x=n;
		y=1;
	}
	cout<<x<<" "<<y<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,m[101];
int mi=20000000,z,y;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>m[i];
	for(int i=1;i<=n;i++){
		int x=i+1,k,l;
		if(x>n)x=1;
		l=m[i]-m[x];
		k=abs(l);
		if(k<mi){
			mi=k;z=i;y=x;
		}
	}
	cout<<z<<' '<<y;
	return 0;
}


#include<cstdio>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<fstream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int mins=9999999;
	int a[n+1];
	int x,y;
	for(int i=2;i<=n;i++)
	{
		if(mins>abs(a[i]-a[i-1]))
		{
			mins=min(mins,abs(a[i]-a[i-1]));
			x=i;
			y=i-1;
		}
	}
	if(mins>abs(a[1]-a[n]))
	{
		mins=min(mins,abs(a[1]-a[n]));
		x=1;
		y=n;
	}
	cout<<x<<" "<<y<<endl;
	return 0;
}


#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int a[101];
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=0;i<n;i++)
        if(minn>abs(a[i%n+1]-a[(i+1)%n+1]))
        {
            minn=abs(a[i%n+1]-a[(i+1)%n+1]);
            minx=i%n+1;
            miny=(i+1)%n+1;
        }
    cout<<minx<<" "<<miny<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,m,t,l,r;
int a[1010];
int b[1010];
bool bb[1010];
vector<pair<int,int>> t0,t1;
int main() {
    scanf("%d %d",&n,&m);
    while(m--) {
        scanf("%d %d %d",&t,&l,&r);
        if (t) t1.push_back({l-1,r-1});
        else t0.push_back({l-1,r-1});
    }
    for (auto p:t1) {
        int x = p.first;
        int y = p.second;
        for (int i=x; i<y; i++) b[i] = 1;
    }
    sort(t0.begin(),t0.end());
    for (auto p:t0) {
        int ans = false;
        int x = p.first;
        int y = p.second;
        for (int i=x; i<y; i++) {
            if (b[i]==0&&ans==false) {
                ans = true;
                a[i]++;
                b[i]=2;
            }
            if (ans==false) {
                printf("NO");
                return 0;
            }
        }
    }
    printf("YES\n");
    for (int i=0; i<n-1; i++) {
        if (b[i]==2&&b[i+1]==2) a[i] = a[i+1]+1;
    }
    //for (int i=0; i<n ;i++) printf("%d ",b[i]);
    //printf("\n");
    for (int i=0; i<n ;i++) printf("%d ",a[i]+1);
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 10000007
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);
#define deg(x) cout<<"--"<<x<<endl;
int II(){int q;scanf("%d",&q);return q;}
int dx[]={0,-1,0,1};
int dy[]={-1,0,1,0};
int dxx[]={0,-1,-1,-1,0,1,1,1};
int dyy[]={-1,-1,0,1,1,1,0,-1};

struct node
{
	int i,st,en;
	bool operator<(const node &seg){
		if(i!=seg.i) return i>seg.i;
		if(st!=seg.st) return st<seg.st;
		return en<seg.en;
	}
};

int ar[1005];
void solve(){
	int n,m;cin>>n>>m;
	vector<node>v;
	for(int i=0; i<m; i++){
		int q,w,r;cin>>q>>w>>r;
		v.pb({q,w,r});
	}
	sort(ALL(v));
	for(auto it:v){
		//cout<<it.i<<" "<<it.st<<" "<<it.en<<endl;
		if(it.i==1){
			ar[it.st]--;
			for(int i=it.st+1; i<=it.en; i++){
				ar[i]++;
			}
		}
	}
	for(int i=1; i<=n; i++){
		if(i==1) ar[i]+=1000;
		else ar[i]+=ar[i-1];
	}
	for(auto it:v){
		if(it.i==0){
			bool bo=0;
			for(int i=it.st+1; i<=it.en; i++){
				if(ar[i-1]>ar[i]) bo=1;
			}
			if(bo==0){
				cout<<"NO"<<endl;
				return;
			}
		}else{
			for(int i=it.st+1; i<=it.en; i++){
				if(ar[i-1]>ar[i]){
					cout<<"NO"<<endl;
					return;
				}
			}
		}
	}
	cout<<"YES"<<endl;
	for(int i=1; i<=n; i++){
		cout<<ar[i]<<" ";
	}
	cout<<endl;
}

main(){
    #ifndef ONLINE_JUDGE
    clock_t tStart = clock();
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
   	solve();
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1e9
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()

int main(){
	int n,m;cin>>n>>m;
	int a[n+10];
	for(int i=1;i<=n;i++) a[i]=1000;
	vector<pair<int,pii>>v;
	for(int i=0;i<m;i++){
		int t,q,w;cin>>t>>q>>w;
		v.pb({t,{q,w}});
		if(t==0){
			for(int j=q+1;j<=w;j++) a[j]=a[q]-1;
		}
	}
	for(int i=0;i<m;i++){
		int t=v[i].F,q=v[i].S.F,w=v[i].S.S;
		if(t==1){
			for(int j=q+1;j<=w;j++){
				if(a[j]!=a[j-1]&&j<n){
					a[j+1]=a[j];
					a[j]=a[j-1];
				}
			}
		}
	}
	for(int i=0;i<m;i++){
		int t=v[i].F,q=v[i].S.F,w=v[i].S.S;
		if(t==1){
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]){
					cout<<"NO"<<endl;
					return 0;
				}
			}
		}else{
			bool bo=0;
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]){
					bo=1;
				}
			}
			if(bo==0){
				cout<<"NO"<<endl;
				return 0;
			}
		}
	}
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++) cout<<a[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1e9
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()

int main(){
	int n,m;cin>>n>>m;
	int a[n+10];
	for(int i=1;i<=n;i++) a[i]=1000;
	vector<pair<int,pii>>v;
	for(int i=0;i<m;i++){
		int t,q,w;cin>>t>>q>>w;
		v.pb({t,{q,w}});
		if(t==0){
			for(int j=q+1;j<=w;j++) a[j]=a[q]-1;
		}
	}
	for(int i=0;i<m;i++){
		int t=v[i].F,q=v[i].S.F,w=v[i].S.S;
		if(t==1){
			for(int j=q+1;j<=w;j++){
				if(a[j]!=a[j-1]&&j<n) a[j]=a[j-1];
			}
		}
	}
	for(int i=0;i<m;i++){
		int t=v[i].F,q=v[i].S.F,w=v[i].S.S;
		if(t==1){
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]){
					cout<<"NO"<<endl;
					return 0;
				}
			}
		}else{
			bool bo=0;
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]){
					bo=1;
				}
			}
			if(bo==0){
				cout<<"NO"<<endl;
				return 0;
			}
		}
	}
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++) cout<<a[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 10000007
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);
#define deg(x) cout<<"--"<<x<<endl;
int II(){int q;scanf("%d",&q);return q;}
int dx[]={0,-1,0,1};
int dy[]={-1,0,1,0};
int dxx[]={0,-1,-1,-1,0,1,1,1};
int dyy[]={-1,-1,0,1,1,1,0,-1};

struct node
{
	int i,st,en;
	bool operator<(const node &seg){
		if(i!=seg.i) return i>seg.i;
		if(st!=seg.st) return st<seg.st;
		return en<seg.en;
	}
};

int ar[1005];
int start_ar[1005],chata[1005];
void solve(){
	int n,m;cin>>n>>m;
	vector<node>v;
	for(int i=0; i<m; i++){
		int q,w,r;cin>>q>>w>>r;
		v.pb({q,w,r});
	}
	sort(ALL(v));
	for(auto it:v){

		if(it.i==1){
			start_ar[it.st]++;
			for(int i=it.st+1; i<=it.en; i++){
				chata[i]++;
			}
		}else{
			bool bo=0;
			for(int i=it.st+1; i<=it.en; i++){
				if(start_ar[i]>0 && chata[i]==0){
					ar[i]--;
					bo=1;
					break;
				}
			}
			if(bo==0){
				for(int i=it.st+1; i<=it.en; i++){
					if(chata[i]==0){
						ar[i]--;
						break;
					}
				}
			}
		}
	}
	for(int i=1; i<=n; i++){
		if(i==1) ar[i]+=100000;
		else ar[i]+=ar[i-1];
		//cout<<ar[i]<<" ";
	}
	for(auto it:v){
		if(it.i==0){
			bool bo=0;
			for(int i=it.st+1; i<=it.en; i++){
				if(ar[i-1]>ar[i]) bo=1;
			}
			if(bo==0){
				cout<<"NO"<<endl;
				return;
			}
		}else{
			for(int i=it.st+1; i<=it.en; i++){
				if(ar[i-1]>ar[i]){
					cout<<"NO"<<endl;
					return;
				}
			}
		}
	}
	cout<<"YES"<<endl;
	for(int i=1; i<=n; i++){
		cout<<ar[i]<<" ";
	}
	cout<<endl;
}

main(){
    #ifndef ONLINE_JUDGE
    clock_t tStart = clock();
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
   	solve();
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1e9
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()
int a[10000];
int main(){
	int n,m;cin>>n>>m;
	vector<pair<int,pii>>v;
	for(int i=0;i<m;i++){
		int t,q,w;cin>>t>>q>>w;
		v.pb({t,{q,w}});
		if(t==1){
			for(int j=q+1;j<=w;j++) a[j]=0;
		}else{
			for(int j=q+1;j<=w;j++) a[j]=-1;
		}
	}
	a[1]+=1000;
	for(int i=2;i<=n;i++) a[i]+=a[i-1];
	for(int i=0;i<m;i++){
		int t=v[i].F,q=v[i].S.F,w=v[i].S.S;
		if(t==1){
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]){
					cout<<"NO"<<endl;
					return 0;
				}
			}
		}else{
			bool bo=0;
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]) bo=1;
			}
			if(bo==0){
				cout<<"NO"<<endl;
				return 0;
			}
		}
	}
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++) cout<<a[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1e9
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()

int main(){
	int n,m;cin>>n>>m;
	int a[n+10];
	for(int i=1;i<=n;i++) a[i]=1000;
	vector<pair<int,pii>>v;
	for(int i=0;i<m;i++){
		int t,q,w;cin>>t>>q>>w;
		v.pb({t,{q,w}});
		if(t==0){
			for(int j=q+1;j<=w;j++) a[j]=a[q]-1;
		}
	}
	for(int i=0;i<m;i++){
		int t=v[i].F,q=v[i].S.F,w=v[i].S.S;
		if(t==1){
			for(int j=q+1;j<=w;j++){
				if(a[j]!=a[j-1]) a[j]=a[j-1];
			}
		}
	}
	for(int i=0;i<m;i++){
		int t=v[i].F,q=v[i].S.F,w=v[i].S.S;
		if(t==1){
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]){
					cout<<"NO"<<endl;
					return 0;
				}
			}
		}else{
			bool bo=0;
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]){
					bo=1;
				}
			}
			if(bo==0){
				cout<<"NO"<<endl;
				return 0;
			}
		}
	}
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++) cout<<a[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 10000007
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);
#define deg(x) cout<<"--"<<x<<endl;
int II(){int q;scanf("%d",&q);return q;}
int dx[]={0,-1,0,1};
int dy[]={-1,0,1,0};
int dxx[]={0,-1,-1,-1,0,1,1,1};
int dyy[]={-1,-1,0,1,1,1,0,-1};

struct node
{
	int i,st,en;
	bool operator<(const node &seg){
		if(i!=seg.i) return i>seg.i;
		if(st!=seg.st) return st<seg.st;
		return en<seg.en;
	}
};

int ar[1005];
int start_ar[1005],chata[1005];
void solve(){
	int n,m;cin>>n>>m;
	vector<node>v;
	for(int i=0; i<m; i++){
		int q,w,r;cin>>q>>w>>r;
		v.pb({q,w,r});
	}
	sort(ALL(v));
	for(auto it:v){

		if(it.i==1){
			start_ar[it.st]++;
			for(int i=it.st+1; i<=it.en; i++){
				chata[i]++;
			}
		}else{
			bool bo=0;
			for(int i=it.st+1; i<=it.en; i++){
				if(start_ar[i]>0 && chata[i]==0){
					ar[i]--;
					bo=1;
					break;
				}
			}
			if(bo==0){
				for(int i=it.st+1; i<=it.en; i++){
					if(chata[i]==0){
						ar[i]--;
						break;
					}
				}
			}
		}
	}
	for(int i=1; i<=n; i++){
		if(i==1) ar[i]+=1000;
		else ar[i]+=ar[i-1];
		//cout<<ar[i]<<" ";
	}
	for(auto it:v){
		if(it.i==0){
			bool bo=0;
			for(int i=it.st+1; i<=it.en; i++){
				if(ar[i-1]>ar[i]) bo=1;
			}
			if(bo==0){
				cout<<"NO"<<endl;
				return;
			}
		}else{
			for(int i=it.st+1; i<=it.en; i++){
				if(ar[i-1]>ar[i]){
					cout<<"NO"<<endl;
					return;
				}
			}
		}
	}
	cout<<"YES"<<endl;
	for(int i=1; i<=n; i++){
		cout<<ar[i]<<" ";
	}
	cout<<endl;
}

main(){
    #ifndef ONLINE_JUDGE
    clock_t tStart = clock();
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
   	solve();
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 10000007
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);
#define deg(x) cout<<"--"<<x<<endl;
int II(){int q;scanf("%d",&q);return q;}
int dx[]={0,-1,0,1};
int dy[]={-1,0,1,0};
int dxx[]={0,-1,-1,-1,0,1,1,1};
int dyy[]={-1,-1,0,1,1,1,0,-1};

struct node
{
	int i,st,en;
	bool operator<(const node &seg){
		if(i!=seg.i) return i>seg.i;
		if(st!=seg.st) return st<seg.st;
		return en<seg.en;
	}
};

int ar[1005];
void solve(){
	int n,m;cin>>n>>m;
	vector<node>v;
	for(int i=0; i<m; i++){
		int q,w,r;cin>>q>>w>>r;
		v.pb({q,w,r});
	}
	sort(ALL(v));
	for(auto it:v){
		if(it.i==1){
			for(int i=it.st; i<=it.en; i++){
				ar[i]=1;
			}
		}else{
			bool bo=0;
			for(int i=it.st+1; i<=it.en; i++){
				if(ar[i]==0){
					ar[i]=-1;
					bo=1;
					break;
				}
			}
			if(bo==0) ar[it.st+1]=-1;
		}
	}
	for(int i=1; i<=n; i++){
		if(ar[i]==0) ar[i]=1;
		if(i==1) ar[i]+=1000;
		else ar[i]+=ar[i-1];
	}
	for(auto it:v){
		if(it.i==0){
			bool bo=0;
			for(int i=it.st+1; i<=it.en; i++){
				if(ar[i-1]>ar[i]) bo=1;
			}
			if(bo==0){
				cout<<"NO"<<endl;
				return;
			}
		}else{
			for(int i=it.st+1; i<=it.en; i++){
				if(ar[i-1]>ar[i]){
					cout<<"NO"<<endl;
					return;
				}
			}
		}
	}
	cout<<"YES"<<endl;
	for(int i=1; i<=n; i++){
		cout<<ar[i]<<" ";
	}
	cout<<endl;
}

main(){
    #ifndef ONLINE_JUDGE
    clock_t tStart = clock();
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
   	solve();
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1e9
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()
int a[10000];
int main(){
	int n,m;cin>>n>>m;
	vector<pair<int,pii>>v;
	for(int i=0;i<m;i++){
		int t,q,w;cin>>t>>q>>w;
		v.pb({t,{q,w}});
		if(t==1){
			for(int j=q+1;j<=w;j++) a[j]=1;
			a[q]=-1;
		}
	}
	a[1]+=1000;
	for(int i=2;i<=n;i++) a[i]+=a[i-1];
	for(int i=0;i<m;i++){
		int t=v[i].F,q=v[i].S.F,w=v[i].S.S;
		if(t==1){
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]){
					cout<<"NO"<<endl;
					return 0;
				}
			}
		}else{
			bool bo=0;
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]) bo=1;
			}
			if(bo==0){
				cout<<"NO"<<endl;
				return 0;
			}
		}
	}
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++) cout<<a[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1e9
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()
int a[10000];
int main(){
	int n,m;cin>>n>>m;
	vector<pair<int,pii>>v;
	for(int i=0;i<m;i++){
		int t,q,w;cin>>t>>q>>w;
		v.pb({t,{q,w}});
		if(t==1){
			for(int j=q+1;j<=w;j++) a[j]=1;
			a[w+1]=-1;
		}
	}
	a[1]+=1000;
	for(int i=2;i<=n;i++) a[i]+=a[i-1];
	for(int i=0;i<m;i++){
		int t=v[i].F,q=v[i].S.F,w=v[i].S.S;
		if(t==1){
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]){
					cout<<"NO"<<endl;
					return 0;
				}
			}
		}else{
			bool bo=0;
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]) bo=1;
			}
			if(bo==0){
				cout<<"NO"<<endl;
				return 0;
			}
		}
	}
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++) cout<<a[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 10000007
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);
#define deg(x) cout<<"--"<<x<<endl;
int II(){int q;scanf("%d",&q);return q;}
int dx[]={0,-1,0,1};
int dy[]={-1,0,1,0};
int dxx[]={0,-1,-1,-1,0,1,1,1};
int dyy[]={-1,-1,0,1,1,1,0,-1};

struct node
{
	int i,st,en;
	bool operator<(const node &seg){
		if(i!=seg.i) return i>seg.i;
		if(st!=seg.st) return st<seg.st;
		return en<seg.en;
	}
};

int ar[1005];
void solve(){
	for(int i=1; i<=1000; i++) ar[i]=mod;
	int n,m;cin>>n>>m;
	vector<node>v;
	for(int i=0; i<m; i++){
		int q,w,r;cin>>q>>w>>r;
		v.pb({q,w,r});
	}
	sort(ALL(v));
	for(auto it:v){
		//cout<<it.i<<" "<<it.st<<" "<<it.en<<endl;
		if(it.i==1){
			for(int i=it.st; i<=it.en; i++){
				if(ar[i]==mod) ar[i]=0;
			}
			ar[it.st]--;
			for(int i=it.st+1; i<=it.en; i++){
				ar[i]++;
			}
		}else{
			for(int i=it.st+1; i<=it.en; i++){
				if(ar[i]==mod){
					ar[i]=-1;
					break;
				}
			}
		}
	}
	for(int i=1; i<=n; i++){
		if(ar[i]==mod) ar[i]=0;
		if(i==1) ar[i]+=1000;
		else ar[i]+=ar[i-1];
		//cout<<ar[i]<<" ";
	}
	for(auto it:v){
		if(it.i==0){
			bool bo=0;
			for(int i=it.st+1; i<=it.en; i++){
				if(ar[i-1]>ar[i]) bo=1;
			}
			if(bo==0){
				cout<<"NO"<<endl;
				return;
			}
		}else{
			for(int i=it.st+1; i<=it.en; i++){
				if(ar[i-1]>ar[i]){
					cout<<"NO"<<endl;
					return;
				}
			}
		}
	}
	cout<<"YES"<<endl;
	for(int i=1; i<=n; i++){
		cout<<ar[i]<<" ";
	}
	cout<<endl;
}

main(){
    #ifndef ONLINE_JUDGE
    clock_t tStart = clock();
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
   	solve();
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1e9
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()
int a[10000];
int b[10000];
int main(){
	int n,m;cin>>n>>m;
	vector<pair<int,pii>>v;
	for(int i=0;i<m;i++){
		int t,q,w;cin>>t>>q>>w;
		v.pb({t,{q,w}});
		if(t==1){
			for(int j=q;j<w;j++) b[j]=0;
		}else{
			for(int j=q;j<w;j++) b[j]=-1;
		}
	}
	a[1]=1000;
	for(int i=2;i<=n;i++) a[i]=a[i-1]+b[i-1];
	for(int i=0;i<m;i++){
		int t=v[i].F,q=v[i].S.F,w=v[i].S.S;
		if(t==1){
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]){
					cout<<"NO"<<endl;
					return 0;
				}
			}
		}else{
			bool bo=0;
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]) bo=1;
			}
			if(bo==0){
				cout<<"NO"<<endl;
				return 0;
			}
		}
	}
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++) cout<<a[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1e9
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()
int a[10000];
int main(){
	int n,m;cin>>n>>m;
	vector<pair<int,pii>>v;
	for(int i=0;i<m;i++){
		int t,q,w;cin>>t>>q>>w;
		v.pb({t,{q,w}});
		if(t==1){
			for(int j=q+1;j<=w;j++) a[j]=1;
			a[w+1]=-1;
		}
	}
	a[1]+=1000;
	for(int i=2;i<=n;i++) a[i]+=a[i-1];
	for(int i=0;i<m;i++){
		int t=v[i].F,q=v[i].S.F,w=v[i].S.S;
		if(t==1){
			/*for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]){
					cout<<"NO"<<endl;
					return 0;
				}
			}*/
		}else{
			bool bo=0;
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]) bo=1;
			}
			if(bo==0){
				cout<<"NO"<<endl;
				return 0;
			}
		}
	}
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++) cout<<a[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 10000007
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);
#define deg(x) cout<<"--"<<x<<endl;
int II(){int q;scanf("%d",&q);return q;}
int dx[]={0,-1,0,1};
int dy[]={-1,0,1,0};
int dxx[]={0,-1,-1,-1,0,1,1,1};
int dyy[]={-1,-1,0,1,1,1,0,-1};

struct node
{
	int i,st,en;
	bool operator<(const node &seg){
		if(i!=seg.i) return i>seg.i;
		if(st!=seg.st) return st<seg.st;
		return en<seg.en;
	}
};

int ar[1005];
int start_ar[1005],chata[1005];
void solve(){
	int n,m;cin>>n>>m;
	vector<node>v;
	for(int i=0; i<m; i++){
		int q,w,r;cin>>q>>w>>r;
		v.pb({q,w,r});
	}
	sort(ALL(v));
	for(auto it:v){

		if(it.i==1){
			start_ar[it.st]++;
			for(int i=it.st+1; i<=it.en; i++){
				chata[i]++;
			}
		}else{
			for(int i=it.st+1; i<=it.en; i++){
				if(start_ar[i]>0 && chata[i]==0){
					ar[i]--;
					break;
				}
			}
		}
	}
	for(int i=1; i<=n; i++){
		if(i==1) ar[i]+=1000;
		else ar[i]+=ar[i-1];
		//cout<<ar[i]<<" ";
	}
	for(auto it:v){
		if(it.i==0){
			bool bo=0;
			for(int i=it.st+1; i<=it.en; i++){
				if(ar[i-1]>ar[i]) bo=1;
			}
			if(bo==0){
				cout<<"NO"<<endl;
				return;
			}
		}else{
			for(int i=it.st+1; i<=it.en; i++){
				if(ar[i-1]>ar[i]){
					cout<<"NO"<<endl;
					return;
				}
			}
		}
	}
	cout<<"YES"<<endl;
	for(int i=1; i<=n; i++){
		cout<<ar[i]<<" ";
	}
	cout<<endl;
}

main(){
    #ifndef ONLINE_JUDGE
    clock_t tStart = clock();
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
   	solve();
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1e9
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()
int a[10000];
int b[10000];
int main(){
	int n,m;cin>>n>>m;
	vector<pair<int,pii>>v;
	for(int i=0;i<m;i++){
		int t,q,w;cin>>t>>q>>w;
		v.pb({t,{q,w}});
		if(t==1){
			for(int j=q;j<w;j++) b[j]=0;
		}else{
			for(int j=q;j<w;j++) b[j]=-1;
		}
	}
	b[0]=1000;
	for(int i=1;i<=n;i++) a[i]=a[i-1]+b[i-1];
	for(int i=0;i<m;i++){
		int t=v[i].F,q=v[i].S.F,w=v[i].S.S;
		if(t==1){
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]){
					cout<<"NO"<<endl;
					return 0;
				}
			}
		}else{
			bool bo=0;
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]) bo=1;
			}
			if(bo==0){
				cout<<"NO"<<endl;
				return 0;
			}
		}
	}
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++) cout<<a[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1e9
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()
int a[10000];
int main(){
	int n,m;cin>>n>>m;
	vector<pair<int,pii>>v;
	for(int i=0;i<m;i++){
		int t,q,w;cin>>t>>q>>w;
		v.pb({t,{q,w}});
		if(t==1){
			for(int j=q+1;j<=w;j++) a[j]=1;
			//a[w+1]=-1;
		}else a[q+1]=-1;
	}
	a[1]+=1000;
	for(int i=2;i<=n;i++) a[i]+=a[i-1];
	for(int i=0;i<m;i++){
		int t=v[i].F,q=v[i].S.F,w=v[i].S.S;
		if(t==1){
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]){
					cout<<"NO"<<endl;
					return 0;
				}
			}
		}else{
			bool bo=0;
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]) bo=1;
			}
			if(bo==0){
				cout<<"NO"<<endl;
				return 0;
			}
		}
	}
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++) cout<<a[i]<<" ";
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 1e9
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()
int a[10000];
int main(){
	int n,m;cin>>n>>m;
	vector<pair<int,pii>>v;
	for(int i=0;i<m;i++){
		int t,q,w;cin>>t>>q>>w;
		v.pb({t,{q,w}});
		if(t==1){
			for(int j=q+1;j<=w;j++) a[j]=1,a[j+1]=-1;
			//a[w+1]=-1;
		}else a[q+1]=-1;
	}
	a[1]+=1000;
	for(int i=2;i<=n;i++) a[i]+=a[i-1];
	for(int i=0;i<m;i++){
		int t=v[i].F,q=v[i].S.F,w=v[i].S.S;
		if(t==1){
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]){
					cout<<"NO"<<endl;
					return 0;
				}
			}
		}else{
			bool bo=0;
			for(int j=q+1;j<=w;j++){
				if(a[j-1]>a[j]) bo=1;
			}
			if(bo==0){
				cout<<"NO"<<endl;
				return 0;
			}
		}
	}
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++) cout<<a[i]<<" ";
}


// Bismillahirrahmanirrahim

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

vector<pair<int, int>> lines;

vector<pair<int, int>> nsort;
int main() {
  int n ,m ;
  cin >> n >> m;

  for(int i = 0; i < m; i++) {
    int t, l, r; cin >> t >> l >> r;
    if(t == 1) {
      if(lines.size() == 0) {lines.push_back(make_pair(l, r));}
      else{
        bool inar = false;
        for(int j = 0; j < lines.size(); j++) {
          if((l <= lines[j].second && l >= lines[j].first) ||
             (r <= lines[j].second && r >= lines[j].first) ||
             (l <= lines[j].first && r >= lines[j].second)){
            lines[j].first = min(l, lines[j].first); lines[j].second = max(lines[j].second, r);inar = true;break;
          }
        }
        if(!inar) lines[j].push_back(make_pair(l, r));
      }
    }
    else nsort.push_back(make_pair(l, r));
  }
  vector<int> vec(n+1,0);
  int k = 2;
  for(int i = 0; i < lines.size();i++) {
    k -= 2;
    for(int j = lines[i].first; j <= lines[i].second; j++) {
      vec[j] = ++k;
    }
  }
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first; int r1 = nsort[i].second;
    for(int j = 0; j < lines.size(); j++) {
      int l2 = lines[j].first; int r2 = lines[j].second;
      if((l1>=l2 && l1 <= r2) && (r1 >= l1 && r1 <= r2)) {cout << "NO"; return 0;}
    }
  }
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first;
    if(vec[l1] == 0) vec[l1] = vec[l1+1] + 1;
  }
  for(int i = 0; i <= n; i++) vec[i]++;
  cout << "YES" << endl;
  for(int i = 1; i <= n; i++) cout << vec[i] << " ";

}


// Bismillahirrahmanirrahim

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

vector<pair<int, int>> lines;

vector<pair<int, int>> nsort;
int main() {
  int n ,m ;
  cin >> n >> m;

  for(int i = 0; i < m; i++) {
    int t, l, r; cin >> t >> l >> r;
    if(t == 1) {
      if(lines.size() == 0) {lines.push_back(make_pair(l, r));}
      else{
        for(int j = 0; j < lines.size(); j++) {
          if((l <= lines[j].second && l >= lines[j].first) ||
             (r <= lines[j].second && r >= lines[j].first) ||
             (l <= lines[j].first && r >= lines[j].second)){
            lines[j].first = min(l, lines[j].first); lines[j].second = max(lines[j].second, r);break;
          }else lines.push_back(make_pair(l, r));
        }
      }
    }
    else nsort.push_back(make_pair(l, r));
  }
  vector<int> vec(n+1,0);
  int k = 2;
  for(int i = 0; i < lines.size();i++) {
    k -= 2;
    for(int j = lines[i].first; j <= lines[i].second; j++) {
      vec[j] = ++k;
    }
  }
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first; int r1 = nsort[i].second;
    for(int j = 0; j < lines.size(); j++) {
      int l2 = lines[j].first; int r2 = lines[j].second;
      if((l1>=l2 && l1 <= r2) && (r1 >= l1 && r1 <= r2)) {cout << "NO"; return 0;}
    }
  }
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first;
    if(vec[l1] == 0) vec[l1] = vec[l1+1] + 1;
  }
  for(int i = 0; i <= n; i++) vec[i]++;
  cout << "YES" << endl;
  for(int i = 1; i <= n; i++) cout << vec[i] << " ";

}


// Bismillahirrahmanirrahim

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

vector<pair<int, int>> lines;

vector<pair<int, int>> nsort;
int main() {
  int n ,m ;
  cin >> n >> m;

  for(int i = 0; i < m; i++) {
    int t, l, r; cin >> t >> l >> r;
    if(t == 1) {
      if(lines.size() == 0) {lines.push_back(make_pair(l, r));}
      else{
        bool inar = false;
        for(int j = 0; j < lines.size(); j++) {
          if((l <= lines[j].second && l >= lines[j].first) ||
             (r <= lines[j].second && r >= lines[j].first) ||
             (l <= lines[j].first && r >= lines[j].second)){
            lines[j].first = min(l, lines[j].first); lines[j].second = max(lines[j].second, r);inar = true;break;
          }
        }
        if(!inar) lines.push_back(make_pair(l, r));
      }
    }
    else nsort.push_back(make_pair(l, r));
  }
  sort(nsort.begin(), nsort.end());
  int x = 200000;
  vector<int> vec(n+1,0);
  sort(lines.begin(), lines.end());
  for(int i = 0; i < lines.size();i++) {
    int k = 1;
    for(int j = lines[i].first; j <= lines[i].second; j++) {
      vec[j] = ++k;
    }
  }
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first; int r1 = nsort[i].second;
    for(int j = 0; j < lines.size(); j++) {
      int l2 = lines[j].first; int r2 = lines[j].second;
      if((l1>=l2 && l1 <= r2) && (r1 >= l2 && r1 <= r2)) {cout << "NO"; return 0;}
    }
  }
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first;
    if(vec[l1] == 0) vec[l1] = x--;
  }
  for(int i = 0; i <= n; i++) vec[i]++;
  for(int i = 0; i < nsort.size(); i++) {
    bool not_sort = false;
    int l1 = nsort[i].first; int r1 = nsort[i].second;
    for(int j = l1; j < r1; j++) {
      if(vec[j] > vec[j+1]) {not_sort = true;break;}
    }
    if(!not_sort) {cout <<"NO"; return 0;}
  }

  cout << "YES" << endl;
  for(int i = 1; i <= n; i++) cout << vec[i] << " ";

}


// Bismillahirrahmanirrahim

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

vector<pair<int, int>> lines;

vector<pair<int, int>> nsort;
int main() {
  int n ,m ;
  cin >> n >> m;

  for(int i = 0; i < m; i++) {
    int t, l, r; cin >> t >> l >> r;
    if(t == 1) {
      if(lines.size() == 0) {lines.push_back(make_pair(l, r));}
      else{
        bool inar = false;
        for(int j = 0; j < lines.size(); j++) {
          if((l <= lines[j].second && l >= lines[j].first) ||
             (r <= lines[j].second && r >= lines[j].first) ||
             (l <= lines[j].first && r >= lines[j].second)){
            lines[j].first = min(l, lines[j].first); lines[j].second = max(lines[j].second, r);inar = true;break;
          }
        }
        if(!inar) lines.push_back(make_pair(l, r));
      }
    }
    else nsort.push_back(make_pair(l, r));
  }
  vector<int> vec(n+1,0);
  sort(lines.begin(), lines.end());
  int k = 2;
  for(int i = 0; i < lines.size();i++) {
    k -= 2;
    for(int j = lines[i].first; j <= lines[i].second; j++) {
      vec[j] = ++k;
    }
  }
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first; int r1 = nsort[i].second;
    for(int j = 0; j < lines.size(); j++) {
      int l2 = lines[j].first; int r2 = lines[j].second;
      if((l1>=l2 && l1 <= r2) && (r1 >= l2 && r1 <= r2)) {cout << "NO"; return 0;}
    }
  }
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first;
    if(vec[l1] == 0) vec[l1] = vec[l1+1] + 1;
  }
  for(int i = 0; i <= n; i++) vec[i]++;
  cout << "YES" << endl;
  for(int i = 1; i <= n; i++) cout << vec[i] << " ";

}


// Bismillahirrahmanirrahim

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

vector<pair<int, int>> lines;

vector<pair<int, int>> nsort;
int main() {
  int n ,m ;
  cin >> n >> m;

  for(int i = 0; i < m; i++) {
    int t, l, r; cin >> t >> l >> r;
    if(t == 1) {
      if(lines.size() == 0) {lines.push_back(make_pair(l, r));}
      else{
        for(int j = 0; j < lines.size(); j++) {
          if((l <= lines[j].second && l >= lines[j].first) ||
             (r <= lines[j].second && r >= lines[j].first) ||
             (l <= lines[j].first && r >= lines[j].second)){
            lines[j].first = min(l, lines[j].first); lines[j].second = max(lines[j].second, r);
          }else lines.push_back(make_pair(l, r));
        }
      }
    }
    else nsort.push_back(make_pair(l, r));
  }
  vector<int> vec(n+1,0);
  int k = 2;
  for(int i = 0; i < lines.size();i++) {
    k -= 2;
    for(int j = lines[i].first; j <= lines[i].second; j++) {
      vec[j] = ++k;
    }
  }
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first; int r1 = nsort[i].second;
    for(int j = 0; j < lines.size(); j++) {
      int l2 = lines[j].first; int r2 = lines[j].second;
      if((l1>=l2 && l1 <= r2) && (r1 >= l1 && r1 <= r2)) {cout << "NO"; return 0;}
    }
  }
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first;
    if(vec[l1] == 0) vec[l1] = vec[l1+1] + 1;
  }
  for(int i = 0; i <= n; i++) vec[i]++;
  cout << "YES" << endl;
  for(int i = 1; i <= n; i++) cout << vec[i] << " ";

}


// Bismillahirrahmanirrahim

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

vector<pair<int, int>> lines;

vector<pair<int, int>> nsort;
int main() {
  int n ,m ;
  cin >> n >> m;

  for(int i = 0; i < m; i++) {
    int t, l, r; cin >> t >> l >> r;
    if(t == 1) {
      if(lines.size() == 0) {lines.push_back(make_pair(l, r));}
      else{
        bool inar = false;
        for(int j = 0; j < lines.size(); j++) {
          if((l <= lines[j].second && l >= lines[j].first) ||
             (r <= lines[j].second && r >= lines[j].first) ||
             (l <= lines[j].first && r >= lines[j].second)){
            lines[j].first = min(l, lines[j].first); lines[j].second = max(lines[j].second, r);inar = true;break;
          }
        }
        if(!inar) lines.push_back(make_pair(l, r));
      }
    }
    else nsort.push_back(make_pair(l, r));
  }
  vector<int> vec(n+1,0);
  sort(lines.begin(), lines.end());
  int k = 2;
  for(int i = 0; i < lines.size();i++) {
    k -= 2;
    for(int j = lines[i].first; j <= lines[i].second; j++) {
      vec[j] = ++k;
    }
  }
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first; int r1 = nsort[i].second;
    for(int j = 0; j < lines.size(); j++) {
      int l2 = lines[j].first; int r2 = lines[j].second;
      if((l1>=l2 && l1 <= r2) && (r1 >= l1 && r1 <= r2)) {cout << "NO"; return 0;}
    }
  }
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first;
    if(vec[l1] == 0) vec[l1] = vec[l1+1] + 1;
  }
  for(int i = 0; i <= n; i++) vec[i]++;
  cout << "YES" << endl;
  for(int i = 1; i <= n; i++) cout << vec[i] << " ";

}


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

vector<pair<int, int>> lines;

vector<pair<int, int>> nsort;
int main() {
  int n ,m ;
  cin >> n >> m;

  for(int i = 0; i < m; i++) {
    int t, l, r; cin >> t >> l >> r;
    if(t == 1) {
      if(lines.size() == 0) {lines.push_back(make_pair(l, r));}
      else{
        bool inar = false;
        for(int j = 0; j < lines.size(); j++) {
          if((l <= lines[j].second && l >= lines[j].first) ||
             (r <= lines[j].second && r >= lines[j].first) ||
             (l <= lines[j].first && r >= lines[j].second)){
            lines[j].first = min(l, lines[j].first); lines[j].second = max(lines[j].second, r);inar = true;break;
          }
        }
        if(!inar) lines.push_back(make_pair(l, r));
      }
    }
    else nsort.push_back(make_pair(l, r));
  }
  sort(lines.begin(), lines.end());
  sort(nsort.begin(), nsort.end());
  vector<int> vec(2000,0);
  int lsize = lines.size();
  for(int i = 0; i < lsize; i++) {
    for(int j = 0; j < nsort.size(); j++) {
      if((nsort[j].first >= lines[i].first && nsort[j].first <= lines[i].second) &&
        (nsort[j].second >= lines[i].first && nsort[j].second <= lines[i].second)){
          cout << "NO" << endl; return 0;
        }
    }
  }
  int k;
  for(int i = 0; i < lsize; i++) {
    k = 1;
    for(int j = lines[i].first; j <= lines[i].second; j++) {
      vec[j] = k++;
    }
  }
  int x = 200000;
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first;
    if(vec[l1] == 0) vec[l1] = x--;
  }
  cout << "YES" << endl;
  for(int i = 1; i <= n; i++) {
    cout << vec[i] + 1 << " ";
  }

}


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

vector<pair<int, int>> lines;

vector<pair<int, int>> nsort;
int main() {
  int n ,m ;
  cin >> n >> m;

  for(int i = 0; i < m; i++) {
    int t, l, r; cin >> t >> l >> r;
    if(t == 1) {
      if(lines.size() == 0) {lines.push_back(make_pair(l, r));}
      else{
        bool inar = false;
        for(int j = 0; j < lines.size(); j++) {
          if((l <= lines[j].second && l >= lines[j].first) ||
             (r <= lines[j].second && r >= lines[j].first) ||
             (l <= lines[j].first && r >= lines[j].second)){
            lines[j].first = min(l, lines[j].first); lines[j].second = max(lines[j].second, r);inar = true;break;
          }
        }
        if(!inar) lines.push_back(make_pair(l, r));
      }
    }
    else nsort.push_back(make_pair(l, r));
  }
  sort(lines.begin(), lines.end());
  sort(nsort.begin(), nsort.end());
  vector<int> vec(2000,0);
  int lsize = lines.size();
  for(int i = 0; i < lsize; i++) {
    for(int j = 0; j < nsort.size(); j++) {
      if((nsort[j].first >= lines[i].first && nsort[j].first <= lines[i].second) &&
        (nsort[j].second >= lines[i].first && nsort[j].second <= lines[i].second)){
          cout << "NO" << endl; return 0;
        }
    }
  }
  int k = 1;
  for(int i = 0; i < lsize; i++) {
    for(int j = lines[i].first; j <= lines[i].second; j++) {
      vec[j] = k++;
    }
    k -= 2;
  }
  int x = 200000;
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first;
    if(vec[l1] == 0) vec[l1] = x--;
  }
  cout << "YES" << endl;
  for(int i = 1; i <= n; i++) {
    cout << vec[i] + 1 << " ";
  }

}


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

vector<pair<int, int>> sorts;
vector<pair<int, int>> nosorts;
int arr[1001];
int res[1001];
bool is_sort(int l, int r) {
  for(int i = l+1; i <= r; i++) {
    if(res[i] < res[i-1]) return false;
  }
  return true;
}
int main() {
  int n, m; cin >> n >> m;
  for(int i = 0; i < 1001; i++) arr[i] = -1;
  for(int i = 0; i < m; i++) {
    int t, l, r;
    cin >> t >> l >> r;
    if(t == 1){
      for(int j = l; j <   r; j++) arr[j]++;
      sorts.push_back(make_pair(l, r));
    }
    else nosorts.push_back(make_pair(l, r));
  }
  res[1] = 10000;
  for(int i = 2; i < 1001; i++) {
    res[i] = res[i-1] + arr[i - 1];
  }

  for(int i = 0; i < sorts.size(); i++) {
    if(!is_sort(sorts[i].first, sorts[i].second)) {cout << "NO" << endl; return 0;}
  }
  for(int i = 0; i < nosorts.size(); i++) {
    if(is_sort(nosorts[i].first, nosorts[i].second)) {cout << "NO" << endl; return 0;}
  }
  cout << "YES" << endl;
  for(int i = 1; i <= n; i++) {
    cout << res[i] << " ";
  }

}


// Bismillahirrahmanirrahim

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

vector<pair<int, int>> lines;

vector<pair<int, int>> nsort;
int main() {
  int n ,m ;
  cin >> n >> m;

  for(int i = 0; i < m; i++) {
    int t, l, r; cin >> t >> l >> r;
    if(t == 1) {
      if(lines.size() == 0) {lines.push_back(make_pair(l, r));}
      else{
        bool inar = false;
        for(int j = 0; j < lines.size(); j++) {
          if((l <= lines[j].second && l >= lines[j].first) ||
             (r <= lines[j].second && r >= lines[j].first) ||
             (l <= lines[j].first && r >= lines[j].second)){
            lines[j].first = min(l, lines[j].first); lines[j].second = max(lines[j].second, r);inar = true;break;
          }
        }
        if(!inar) lines.push_back(make_pair(l, r));
      }
    }
    else nsort.push_back(make_pair(l, r));
  }
  sort(nsort.begin(), nsort.end());
  int x = 200000;
  vector<int> vec(n+1,0);
  sort(lines.begin(), lines.end());
  int k = 2;
  for(int i = 0; i < lines.size();i++) {
    k -= 2;
    for(int j = lines[i].first; j <= lines[i].second; j++) {
      vec[j] = ++k;
    }
  }
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first; int r1 = nsort[i].second;
    for(int j = 0; j < lines.size(); j++) {
      int l2 = lines[j].first; int r2 = lines[j].second;
      if((l1>=l2 && l1 <= r2) && (r1 >= l2 && r1 <= r2)) {cout << "NO"; return 0;}
    }
  }
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first;
    if(vec[l1] == 0) vec[l1] = x--;
  }
  for(int i = 0; i <= n; i++) vec[i]++;
  cout << "YES" << endl;
  for(int i = 1; i <= n; i++) cout << vec[i] << " ";

}


// Bismillahirrahmanirrahim

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

vector<pair<int, int>> lines;

vector<pair<int, int>> nsort;
int main() {
  int n ,m ;
  cin >> n >> m;

  for(int i = 0; i < m; i++) {
    int t, l, r; cin >> t >> l >> r;
    if(t == 1) {
      if(lines.size() == 0) {lines.push_back(make_pair(l, r));}
      else{
        bool inar = false;
        for(int j = 0; j < lines.size(); j++) {
          if((l <= lines[j].second && l >= lines[j].first) ||
             (r <= lines[j].second && r >= lines[j].first) ||
             (l <= lines[j].first && r >= lines[j].second)){
            lines[j].first = min(l, lines[j].first); lines[j].second = max(lines[j].second, r);inar = true;break;
          }
        }
        if(!inar) lines.push_back(make_pair(l, r));
      }
    }
    else nsort.push_back(make_pair(l, r));
  }
  vector<int> vec(n+1,0);
  int k = 2;
  for(int i = 0; i < lines.size();i++) {
    k -= 2;
    for(int j = lines[i].first; j <= lines[i].second; j++) {
      vec[j] = ++k;
    }
  }
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first; int r1 = nsort[i].second;
    for(int j = 0; j < lines.size(); j++) {
      int l2 = lines[j].first; int r2 = lines[j].second;
      if((l1>=l2 && l1 <= r2) && (r1 >= l1 && r1 <= r2)) {cout << "NO"; return 0;}
    }
  }
  for(int i = 0; i < nsort.size(); i++) {
    int l1 = nsort[i].first;
    if(vec[l1] == 0) vec[l1] = vec[l1+1] + 1;
  }
  for(int i = 0; i <= n; i++) vec[i]++;
  cout << "YES" << endl;
  for(int i = 1; i <= n; i++) cout << vec[i] << " ";

}


//BISMILLAHIR RAHMANIR RAHIM
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <list>
#define cos(a) cos(a*pi/180)
#define sin(a) sin(a*pi/180)
#define tan(a) tan(a*pi/180)
#define cosi(a) acos(a)/(pi/180)
#define sini(a) asin(a)/(pi/180)
#define tani(a) atan(a)/(pi/180)
#define mem(a, b) (memset(a, b, sizeof(a)))
#define read (freopen("input.txt", "r", stdin))
#define write (freopen("output.txt", "w", stdout))
#define fastIO (ios::sync_with_stdio(0), cin.tie(0), cout.tie(0));
#define dis(x1, y1, x2, y2) ((x1-x2) * (x1-x2)) + ((y1-y2) * (y1-y2))
#define debug (printf("PINK FLOYD:)\n"))
#define iosflags (cout<<setiosflags(ios::fixed)<<setprecision(8))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define pi 3.1415926535897932384
#define INF 2147483647
#define EPS 1e-8
#define MOD 1000000007
#define MAX 100005
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

const int inf = 1<<28;
int dirx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int diry[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int dx[] = { -1, 1, 0, 0 };
int dy[] = { 0, 0, -1, 1 };
int fx[] = { -2, -2, -1, -1,  1,  1,  2,  2 };
int fy[] = { -1,  1, -2,  2, -2,  2, -1,  1 };

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

vii vp1, vp2;
int start[MAX], arr[MAX];

int main()
{
	fastIO;

	int n, m, t, l, r;

    cin>>n>>m;

	int k = 1e5;
	arr[0] = 1e5;
	k++;
	for(int i = 1; i <= n; i++){
        arr[i] = k++;
	}

	for(int i = 0; i < m; i++){
        cin>>t>>l>>r;
        if(t == 1){
            start[l] = 1;
            vp1.pb(mp(l, r));
        }
        else
            vp2.pb(mp(l, r));
	}

	for(int i = 0; i < vp2.size(); i++){
        for(int j = 0; j < vp1.size(); j++){
            if(vp2[i].ff >= vp1[j].ff && vp2[i].ss <= vp1[j].ss){
                cout<<"NO"<<endl;
                return 0;
            }
        }
	}

    cout<<"YES"<<endl;
	for(int i = 0; i < vp2.size(); i++){
        for(int j = vp2[i].ff; j <= vp2[i].ss; j++){
            if(start[j]){
                arr[j] = arr[j-1] - 1;
                break;
            }
        }
	}

	for(int i = 1; i <= n; i++){
        cout<<arr[i]<<" ";
	}
	cout<<endl;

    return 0;
}


//BISMILLAHIR RAHMANIR RAHIM
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <list>
#define cos(a) cos(a*pi/180)
#define sin(a) sin(a*pi/180)
#define tan(a) tan(a*pi/180)
#define cosi(a) acos(a)/(pi/180)
#define sini(a) asin(a)/(pi/180)
#define tani(a) atan(a)/(pi/180)
#define mem(a, b) (memset(a, b, sizeof(a)))
#define read (freopen("input.txt", "r", stdin))
#define write (freopen("output.txt", "w", stdout))
#define fastIO (ios::sync_with_stdio(0), cin.tie(0), cout.tie(0));
#define dis(x1, y1, x2, y2) ((x1-x2) * (x1-x2)) + ((y1-y2) * (y1-y2))
#define debug (printf("PINK FLOYD:)\n"))
#define iosflags (cout<<setiosflags(ios::fixed)<<setprecision(8))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define pi 3.1415926535897932384
#define INF 2147483647
#define EPS 1e-8
#define MOD 1000000007
#define MAX 100005
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

const int inf = 1<<28;
int dirx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int diry[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int dx[] = { -1, 1, 0, 0 };
int dy[] = { 0, 0, -1, 1 };
int fx[] = { -2, -2, -1, -1,  1,  1,  2,  2 };
int fy[] = { -1,  1, -2,  2, -2,  2, -1,  1 };

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

vii vp1, vp2;
int start[MAX], arr[MAX];

int main()
{
	fastIO;

	int n, m, t, l, r;

    cin>>n>>m;

	int k = 1e5;
	arr[0] = 1e5;
	k++;
	for(int i = 1; i <= n; i++){
        arr[i] = k++;
	}

	for(int i = 0; i < m; i++){
        cin>>t>>l>>r;
        if(t == 1){
            start[l] = 1;
            vp1.pb(mp(l, r));
        }
        else
            vp2.pb(mp(l, r));
	}

	for(int i = 0; i < vp2.size(); i++){
        for(int j = 0; j < vp1.size(); j++){
            if(vp2[i].ff >= vp1[i].ff && vp2[i].ss <= vp1[i].ss){
                cout<<"NO"<<endl;
                return 0;
            }
        }
	}

    cout<<"YES"<<endl;
	for(int i = 0; i < vp2.size(); i++){
        for(int j = vp2[i].ff; j <= vp2[i].ss; j++){
            if(start[j]){
                arr[j] = arr[j-1] - 1;
            }
        }
	}

	for(int i = 1; i <= n; i++){
        cout<<arr[i]<<" ";
	}
	cout<<endl;

    return 0;
}


//BISMILLAHIR RAHMANIR RAHIM
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <list>
#define cos(a) cos(a*pi/180)
#define sin(a) sin(a*pi/180)
#define tan(a) tan(a*pi/180)
#define cosi(a) acos(a)/(pi/180)
#define sini(a) asin(a)/(pi/180)
#define tani(a) atan(a)/(pi/180)
#define mem(a, b) (memset(a, b, sizeof(a)))
#define read (freopen("input.txt", "r", stdin))
#define write (freopen("output.txt", "w", stdout))
#define fastIO (ios::sync_with_stdio(0), cin.tie(0), cout.tie(0));
#define dis(x1, y1, x2, y2) ((x1-x2) * (x1-x2)) + ((y1-y2) * (y1-y2))
#define debug (printf("PINK FLOYD:)\n"))
#define iosflags (cout<<setiosflags(ios::fixed)<<setprecision(8))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define pi 3.1415926535897932384
#define INF 2147483647
#define EPS 1e-8
#define MOD 1000000007
#define MAX 1005
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

const int inf = 1<<28;
int dirx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int diry[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int dx[] = { -1, 1, 0, 0 };
int dy[] = { 0, 0, -1, 1 };
int fx[] = { -2, -2, -1, -1,  1,  1,  2,  2 };
int fy[] = { -1,  1, -2,  2, -2,  2, -1,  1 };

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

vii vp1, vp2;
int start[MAX], arr[MAX], valid[MAX];

int main()
{
	fastIO;

	int n, m, t, l, r;

    cin>>n>>m;

	int k = 1e5;
	arr[0] = 1e5;
	k++;
	for(int i = 1; i <= n; i++){
        arr[i] = k++;
	}

	for(int i = 0; i < m; i++){
        cin>>t>>l>>r;
        if(t == 1){
            start[l] = 1;
            vp1.pb(mp(l, r));
        }
        else
            vp2.pb(mp(l, r));
	}

	for(int i = 0; i < vp2.size(); i++){
        for(int j = 0; j < vp1.size(); j++){
            if(vp2[i].ff >= vp1[j].ff && vp2[i].ss <= vp1[j].ss){
                cout<<"NO"<<endl;
                return 0;
            }
        }
	}

    for(int i = 1; i <= n; i++){
        bool flag = true;
        for(int j = 0; j < vp1.size(); j++){
            if(i >= vp1[j].ff && i <= vp1[j].ss){
                flag = false;
                break;
            }
        }
        if(flag)
            valid[i] = 1;
    }
    for(int i = 1; i <= n; i++){
        if(start[i] && !valid[i]){
            bool flag = true;
            for(int j = 0; j < vp1.size(); j++){
                if(i - 1 >= vp1[j].ff && i <= vp1[j].ss){
                    flag = false;
                    break;
                }
            }
            if(flag)
                valid[i] = 1;
        }
    }
	for(int i = 0; i < vp2.size(); i++){
        bool flag = false;
        for(int j = vp2[i].ff; j <= vp2[i].ss; j++){
            if(valid[j]){
                if(arr[j] >= arr[j-1]);
                    arr[j] = arr[j-1] - 1;
                flag = true;
                break;
            }
        }
        if(!flag){
            cout<<"NO"<<endl;
            return 0;
        }
	}

    cout<<"YES"<<endl;
	for(int i = 1; i <= n; i++){
        cout<<arr[i]<<" ";
	}
	cout<<endl;

    return 0;
}


//BISMILLAHIR RAHMANIR RAHIM
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <list>
#define cos(a) cos(a*pi/180)
#define sin(a) sin(a*pi/180)
#define tan(a) tan(a*pi/180)
#define cosi(a) acos(a)/(pi/180)
#define sini(a) asin(a)/(pi/180)
#define tani(a) atan(a)/(pi/180)
#define mem(a, b) (memset(a, b, sizeof(a)))
#define read (freopen("input.txt", "r", stdin))
#define write (freopen("output.txt", "w", stdout))
#define fastIO (ios::sync_with_stdio(0), cin.tie(0), cout.tie(0));
#define dis(x1, y1, x2, y2) ((x1-x2) * (x1-x2)) + ((y1-y2) * (y1-y2))
#define debug (printf("PINK FLOYD:)\n"))
#define iosflags (cout<<setiosflags(ios::fixed)<<setprecision(8))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define pi 3.1415926535897932384
#define INF 2147483647
#define EPS 1e-8
#define MOD 1000000007
#define MAX 100005
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

const int inf = 1<<28;
int dirx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int diry[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int dx[] = { -1, 1, 0, 0 };
int dy[] = { 0, 0, -1, 1 };
int fx[] = { -2, -2, -1, -1,  1,  1,  2,  2 };
int fy[] = { -1,  1, -2,  2, -2,  2, -1,  1 };

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

vii vp1, vp2;
int start[MAX], arr[MAX];

int main()
{
	fastIO;

	int n, m, t, l, r;

    cin>>n>>m;

	int k = 1e5;
	arr[0] = 1e5;
	k++;
	for(int i = 1; i <= n; i++){
        arr[i] = k++;
	}

	for(int i = 0; i < m; i++){
        cin>>t>>l>>r;
        if(t == 1){
            start[l] = 1;
            vp1.pb(mp(l, r));
        }
        else
            vp2.pb(mp(l, r));
	}

	for(int i = 0; i < vp2.size(); i++){
        for(int j = 0; j < vp1.size(); j++){
            if(vp2[i].ff >= vp1[j].ff && vp2[i].ss <= vp1[j].ss){
                cout<<"NO"<<endl;
                return 0;
            }
        }
	}

    cout<<"YES"<<endl;
	for(int i = 0; i < vp2.size(); i++){
        for(int j = vp2[i].ff; j <= vp2[i].ss; j++){
            if(start[j]){
                arr[j] = arr[j-1] - 1;
            }
        }
	}

	for(int i = 1; i <= n; i++){
        cout<<arr[i]<<" ";
	}
	cout<<endl;

    return 0;
}


//BISMILLAHIR RAHMANIR RAHIM
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <list>
#define cos(a) cos(a*pi/180)
#define sin(a) sin(a*pi/180)
#define tan(a) tan(a*pi/180)
#define cosi(a) acos(a)/(pi/180)
#define sini(a) asin(a)/(pi/180)
#define tani(a) atan(a)/(pi/180)
#define mem(a, b) (memset(a, b, sizeof(a)))
#define read (freopen("input.txt", "r", stdin))
#define write (freopen("output.txt", "w", stdout))
#define fastIO (ios::sync_with_stdio(0), cin.tie(0), cout.tie(0));
#define dis(x1, y1, x2, y2) ((x1-x2) * (x1-x2)) + ((y1-y2) * (y1-y2))
#define debug (printf("PINK FLOYD:)\n"))
#define iosflags (cout<<setiosflags(ios::fixed)<<setprecision(8))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define pi 3.1415926535897932384
#define INF 2147483647
#define EPS 1e-8
#define MOD 1000000007
#define MAX 100005
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

const int inf = 1<<28;
int dirx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int diry[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int dx[] = { -1, 1, 0, 0 };
int dy[] = { 0, 0, -1, 1 };
int fx[] = { -2, -2, -1, -1,  1,  1,  2,  2 };
int fy[] = { -1,  1, -2,  2, -2,  2, -1,  1 };

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

vii vp1, vp2;
int start[MAX], arr[MAX], valid[MAX];

int main()
{
	fastIO;

	int n, m, t, l, r;

    cin>>n>>m;

	int k = 1e5;
	arr[0] = 1e5;
	k++;
	for(int i = 1; i <= n; i++){
        arr[i] = k++;
	}

	for(int i = 0; i < m; i++){
        cin>>t>>l>>r;
        if(t == 1){
            start[l] = 1;
            vp1.pb(mp(l, r));
        }
        else
            vp2.pb(mp(l, r));
	}

	for(int i = 0; i < vp2.size(); i++){
        for(int j = 0; j < vp1.size(); j++){
            if(vp2[i].ff >= vp1[j].ff && vp2[i].ss <= vp1[j].ss){
                cout<<"NO"<<endl;
                return 0;
            }
        }
	}

	valid[1] = 1;
    for(int i = 2; i <= n; i++){
        if(start[i]){
            bool flag = true;
            for(int j = 0; j < vp1.size(); j++){
                if(i - 1 >= vp1[j].ff && i <= vp1[j].ss){
                    flag = false;
                    break;
                }
            }
            if(flag)
                valid[i] = 1;
        }
    }
	for(int i = 0; i < vp2.size(); i++){
        for(int j = vp2[i].ff; j <= vp2[i].ss; j++){
            if(start[j] && valid[j]){
                if(arr[j] != arr[j-1] - 1);
                    arr[j] = arr[j-1] - 1;
                break;
            }
        }
	}

	for(int i = 1; i <= n; i++){
        cout<<arr[i]<<" ";
	}
	cout<<endl;

    return 0;
}


//BISMILLAHIR RAHMANIR RAHIM
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <list>
#define cos(a) cos(a*pi/180)
#define sin(a) sin(a*pi/180)
#define tan(a) tan(a*pi/180)
#define cosi(a) acos(a)/(pi/180)
#define sini(a) asin(a)/(pi/180)
#define tani(a) atan(a)/(pi/180)
#define mem(a, b) (memset(a, b, sizeof(a)))
#define read (freopen("input.txt", "r", stdin))
#define write (freopen("output.txt", "w", stdout))
#define fastIO (ios::sync_with_stdio(0), cin.tie(0), cout.tie(0));
#define dis(x1, y1, x2, y2) ((x1-x2) * (x1-x2)) + ((y1-y2) * (y1-y2))
#define debug (printf("PINK FLOYD:)\n"))
#define iosflags (cout<<setiosflags(ios::fixed)<<setprecision(8))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define pi 3.1415926535897932384
#define INF 2147483647
#define EPS 1e-8
#define MOD 1000000007
#define MAX 1005
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

const int inf = 1<<28;
int dirx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int diry[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int dx[] = { -1, 1, 0, 0 };
int dy[] = { 0, 0, -1, 1 };
int fx[] = { -2, -2, -1, -1,  1,  1,  2,  2 };
int fy[] = { -1,  1, -2,  2, -2,  2, -1,  1 };

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

vii vp1, vp2;
int start[MAX], arr[MAX], valid[MAX];

int main()
{
	fastIO;

	int n, m, t, l, r;

    cin>>n>>m;

	int k = 1e5;
	arr[0] = 1e5;
	k++;
	for(int i = 1; i <= n; i++){
        arr[i] = k++;
	}

	for(int i = 0; i < m; i++){
        cin>>t>>l>>r;
        if(t == 1){
            start[l] = 1;
            vp1.pb(mp(l, r));
        }
        else
            vp2.pb(mp(l, r));
	}

	for(int i = 0; i < vp2.size(); i++){
        for(int j = 0; j < vp1.size(); j++){
            if(vp2[i].ff >= vp1[j].ff && vp2[i].ss <= vp1[j].ss){
                cout<<"NO"<<endl;
                return 0;
            }
        }
	}

    for(int i = 1; i <= n; i++){
        bool flag = true;
        for(int j = 0; j < vp1.size(); j++){
            if(i >= vp1[j].ff && i <= vp1[j].ss){
                flag = false;
                break;
            }
        }
        if(flag)
            valid[i] = 1;
    }
    for(int i = 1; i <= n; i++){
        if(start[i] && !valid[i]){
            bool flag = true;
            for(int j = 0; j < vp1.size(); j++){
                if(i - 1 >= vp1[j].ff && i <= vp1[j].ss){
                    flag = false;
                    break;
                }
            }
            if(flag)
                valid[i] = 1;
        }
    }

    sort(vp2.begin(), vp2.end());

	for(int i = 0; i < vp2.size(); i++){
        bool flag = false;
        for(int j = vp2[i].ff + 1; j <= vp2[i].ss; j++){
            if(valid[j]){
                if(arr[j] >= arr[j-1]);
                    arr[j] = arr[j-1] - 1;
                flag = true;
                break;
            }
        }
        if(!flag){
            cout<<"NO"<<endl;
            return 0;
        }
	}

    cout<<"YES"<<endl;
	for(int i = 1; i <= n; i++){
        cout<<arr[i]<<" ";
	}
	cout<<endl;

    return 0;
}


//BISMILLAHIR RAHMANIR RAHIM
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <list>
#define cos(a) cos(a*pi/180)
#define sin(a) sin(a*pi/180)
#define tan(a) tan(a*pi/180)
#define cosi(a) acos(a)/(pi/180)
#define sini(a) asin(a)/(pi/180)
#define tani(a) atan(a)/(pi/180)
#define mem(a, b) (memset(a, b, sizeof(a)))
#define read (freopen("input.txt", "r", stdin))
#define write (freopen("output.txt", "w", stdout))
#define fastIO (ios::sync_with_stdio(0), cin.tie(0), cout.tie(0));
#define dis(x1, y1, x2, y2) ((x1-x2) * (x1-x2)) + ((y1-y2) * (y1-y2))
#define debug (printf("PINK FLOYD:)\n"))
#define iosflags (cout<<setiosflags(ios::fixed)<<setprecision(8))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define pi 3.1415926535897932384
#define INF 2147483647
#define EPS 1e-8
#define MOD 1000000007
#define MAX 1005
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

const int inf = 1<<28;
int dirx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int diry[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int dx[] = { -1, 1, 0, 0 };
int dy[] = { 0, 0, -1, 1 };
int fx[] = { -2, -2, -1, -1,  1,  1,  2,  2 };
int fy[] = { -1,  1, -2,  2, -2,  2, -1,  1 };

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

vii vp1, vp2;
int start[MAX], arr[MAX], valid[MAX];

int main()
{
	fastIO;

	int n, m, t, l, r;

    cin>>n>>m;

	int k = 1e5;
	arr[0] = 1e5;
	k++;
	for(int i = 1; i <= n; i++){
        arr[i] = k++;
	}

	for(int i = 0; i < m; i++){
        cin>>t>>l>>r;
        if(t == 1){
            start[l] = 1;
            vp1.pb(mp(l, r));
        }
        else
            vp2.pb(mp(l, r));
	}

	for(int i = 0; i < vp2.size(); i++){
        for(int j = 0; j < vp1.size(); j++){
            if(vp2[i].ff >= vp1[j].ff && vp2[i].ss <= vp1[j].ss){
                cout<<"NO"<<endl;
                return 0;
            }
        }
	}

    for(int i = 1; i <= n; i++){
        bool flag = true;
        for(int j = 0; j < vp1.size(); j++){
            if(i >= vp1[j].ff && i <= vp1[j].ss){
                flag = false;
                break;
            }
        }
        if(flag)
            valid[i] = 1;
    }
    for(int i = 1; i <= n; i++){
        if(start[i] && !valid[i]){
            bool flag = true;
            for(int j = 0; j < vp1.size(); j++){
                if(i - 1 >= vp1[j].ff && i <= vp1[j].ss){
                    flag = false;
                    break;
                }
            }
            if(flag)
                valid[i] = 1;
        }
    }
	for(int i = 0; i < vp2.size(); i++){
        bool flag = false;
        for(int j = vp2[i].ff; j <= vp2[i].ss; j++){
            if(valid[j]){
                if(arr[j+1] >= arr[j]);
                    arr[j+1] = arr[j] - 1;
                flag = true;
                break;
            }
        }
        if(!flag){
            cout<<"NO"<<endl;
            return 0;
        }
	}

    cout<<"YES"<<endl;
	for(int i = 1; i <= n; i++){
        cout<<arr[i]<<" ";
	}
	cout<<endl;

    return 0;
}


//BISMILLAHIR RAHMANIR RAHIM
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <list>
#define cos(a) cos(a*pi/180)
#define sin(a) sin(a*pi/180)
#define tan(a) tan(a*pi/180)
#define cosi(a) acos(a)/(pi/180)
#define sini(a) asin(a)/(pi/180)
#define tani(a) atan(a)/(pi/180)
#define mem(a, b) (memset(a, b, sizeof(a)))
#define read (freopen("input.txt", "r", stdin))
#define write (freopen("output.txt", "w", stdout))
#define fastIO (ios::sync_with_stdio(0), cin.tie(0), cout.tie(0));
#define dis(x1, y1, x2, y2) ((x1-x2) * (x1-x2)) + ((y1-y2) * (y1-y2))
#define debug (printf("PINK FLOYD:)\n"))
#define iosflags (cout<<setiosflags(ios::fixed)<<setprecision(8))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define pi 3.1415926535897932384
#define INF 2147483647
#define EPS 1e-8
#define MOD 1000000007
#define MAX 1005
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

const int inf = 1<<28;
int dirx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int diry[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int dx[] = { -1, 1, 0, 0 };
int dy[] = { 0, 0, -1, 1 };
int fx[] = { -2, -2, -1, -1,  1,  1,  2,  2 };
int fy[] = { -1,  1, -2,  2, -2,  2, -1,  1 };

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

vii vp1, vp2;
int start[MAX], arr[MAX], valid[MAX];

int main()
{
	fastIO;

	int n, m, t, l, r;

    cin>>n>>m;

	int k = 1e5;
	arr[0] = 1e5;
	k++;
	for(int i = 1; i <= n; i++){
        arr[i] = k++;
	}

	for(int i = 0; i < m; i++){
        cin>>t>>l>>r;
        if(t == 1){
            start[l] = 1;
            vp1.pb(mp(l, r));
        }
        else
            vp2.pb(mp(l, r));
	}

	for(int i = 0; i < vp2.size(); i++){
        for(int j = 0; j < vp1.size(); j++){
            if(vp2[i].ff >= vp1[j].ff && vp2[i].ss <= vp1[j].ss){
                cout<<"NO"<<endl;
                return 0;
            }
        }
	}

    for(int i = 1; i <= n; i++){
        bool flag = true;
        for(int j = 0; j < vp1.size(); j++){
            if(i >= vp1[j].ff && i <= vp1[j].ss){
                flag = false;
                break;
            }
        }
        if(flag)
            valid[i] = 1;
    }
    for(int i = 1; i <= n; i++){
        if(start[i] && !valid[i]){
            bool flag = true;
            for(int j = 0; j < vp1.size(); j++){
                if(i - 1 >= vp1[j].ff && i <= vp1[j].ss){
                    flag = false;
                    break;
                }
            }
            if(flag)
                valid[i] = 1;
        }
    }
	for(int i = 0; i < vp2.size(); i++){
        bool flag = false;
        for(int j = vp2[i].ff + 1; j <= vp2[i].ss; j++){
            if(valid[j]){
                if(arr[j] >= arr[j-1]);
                    arr[j] = arr[j-1] - 1;
                flag = true;
                break;
            }
        }
        if(!flag){
            cout<<"NO"<<endl;
            return 0;
        }
	}

    cout<<"YES"<<endl;
	for(int i = 1; i <= n; i++){
        cout<<arr[i]<<" ";
	}
	cout<<endl;

    return 0;
}


//BISMILLAHIR RAHMANIR RAHIM
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <list>
#define cos(a) cos(a*pi/180)
#define sin(a) sin(a*pi/180)
#define tan(a) tan(a*pi/180)
#define cosi(a) acos(a)/(pi/180)
#define sini(a) asin(a)/(pi/180)
#define tani(a) atan(a)/(pi/180)
#define mem(a, b) (memset(a, b, sizeof(a)))
#define read (freopen("input.txt", "r", stdin))
#define write (freopen("output.txt", "w", stdout))
#define fastIO (ios::sync_with_stdio(0), cin.tie(0), cout.tie(0));
#define dis(x1, y1, x2, y2) ((x1-x2) * (x1-x2)) + ((y1-y2) * (y1-y2))
#define debug (printf("PINK FLOYD:)\n"))
#define iosflags (cout<<setiosflags(ios::fixed)<<setprecision(8))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define pi 3.1415926535897932384
#define INF 2147483647
#define EPS 1e-8
#define MOD 1000000007
#define MAX 100005
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

const int inf = 1<<28;
int dirx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int diry[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int dx[] = { -1, 1, 0, 0 };
int dy[] = { 0, 0, -1, 1 };
int fx[] = { -2, -2, -1, -1,  1,  1,  2,  2 };
int fy[] = { -1,  1, -2,  2, -2,  2, -1,  1 };

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

vii vp1, vp2;
int start[MAX], arr[MAX], valid[MAX];

int main()
{
	fastIO;

	int n, m, t, l, r;

    cin>>n>>m;

	int k = 1e5;
	arr[0] = 1e5;
	k++;
	for(int i = 1; i <= n; i++){
        arr[i] = k++;
	}

	for(int i = 0; i < m; i++){
        cin>>t>>l>>r;
        if(t == 1){
            start[l] = 1;
            vp1.pb(mp(l, r));
        }
        else
            vp2.pb(mp(l, r));
	}

	for(int i = 0; i < vp2.size(); i++){
        for(int j = 0; j < vp1.size(); j++){
            if(vp2[i].ff >= vp1[j].ff && vp2[i].ss <= vp1[j].ss){
                cout<<"NO"<<endl;
                return 0;
            }
        }
	}

	valid[1] = 1;
    for(int i = 2; i <= n; i++){
        if(start[i]){
            bool flag = true;
            for(int j = 0; j < vp1.size(); j++){
                if(i - 1 >= vp1[j].ff && i <= vp1[j].ss){
                    flag = false;
                    break;
                }
            }
            if(flag)
                valid[i] = 1;
        }
    }
	for(int i = 0; i < vp2.size(); i++){
        bool flag = false;
        for(int j = vp2[i].ff; j <= vp2[i].ss; j++){
            if(start[j] && valid[j]){
                if(arr[j] != arr[j-1] - 1);
                    arr[j] = arr[j-1] - 1;
                flag = true;
                break;
            }
        }
        if(!flag){
            cout<<"NO"<<endl;
            return 0;
        }
	}

    cout<<"YES"<<endl;
	for(int i = 1; i <= n; i++){
        cout<<arr[i]<<" ";
	}
	cout<<endl;

    return 0;
}


//BISMILLAHIR RAHMANIR RAHIM
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <list>
#define cos(a) cos(a*pi/180)
#define sin(a) sin(a*pi/180)
#define tan(a) tan(a*pi/180)
#define cosi(a) acos(a)/(pi/180)
#define sini(a) asin(a)/(pi/180)
#define tani(a) atan(a)/(pi/180)
#define mem(a, b) (memset(a, b, sizeof(a)))
#define read (freopen("input.txt", "r", stdin))
#define write (freopen("output.txt", "w", stdout))
#define fastIO (ios::sync_with_stdio(0), cin.tie(0), cout.tie(0));
#define dis(x1, y1, x2, y2) ((x1-x2) * (x1-x2)) + ((y1-y2) * (y1-y2))
#define debug (printf("PINK FLOYD:)\n"))
#define iosflags (cout<<setiosflags(ios::fixed)<<setprecision(8))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define pi 3.1415926535897932384
#define INF 2147483647
#define EPS 1e-8
#define MOD 1000000007
#define MAX 100005
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

const int inf = 1<<28;
int dirx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int diry[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int dx[] = { -1, 1, 0, 0 };
int dy[] = { 0, 0, -1, 1 };
int fx[] = { -2, -2, -1, -1,  1,  1,  2,  2 };
int fy[] = { -1,  1, -2,  2, -2,  2, -1,  1 };

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

vii vp1, vp2;
int start[MAX], arr[MAX], valid[MAX];

int main()
{
	fastIO;

	int n, m, t, l, r;

    cin>>n>>m;

	int k = 1e5;
	arr[0] = 1e5;
	k++;
	for(int i = 1; i <= n; i++){
        arr[i] = k++;
	}

	for(int i = 0; i < m; i++){
        cin>>t>>l>>r;
        if(t == 1){
            start[l] = 1;
            vp1.pb(mp(l, r));
        }
        else
            vp2.pb(mp(l, r));
	}

	for(int i = 0; i < vp2.size(); i++){
        for(int j = 0; j < vp1.size(); j++){
            if(vp2[i].ff >= vp1[j].ff && vp2[i].ss <= vp1[j].ss){
                cout<<"NO"<<endl;
                return 0;
            }
        }
	}

    for(int i = 1; i <= n; i++){
        bool flag = true;
        for(int j = 0; j < vp1.size(); j++){
            if(i >= vp1[j].ff && i <= vp1[j].ss){
                flag = false;
                break;
            }
        }
        if(flag)
            valid[i] = 1;
    }
	valid[1] = 1;
    for(int i = 2; i <= n; i++){
        if(start[i]){
            bool flag = true;
            for(int j = 0; j < vp1.size(); j++){
                if(i - 1 >= vp1[j].ff && i <= vp1[j].ss){
                    flag = false;
                    break;
                }
            }
            if(flag)
                valid[i] = 1;
        }
    }
	for(int i = 0; i < vp2.size(); i++){
        bool flag = false;
        for(int j = vp2[i].ff; j <= vp2[i].ss; j++){
            if(valid[j]){
                if(arr[j] != arr[j-1] - 1);
                    arr[j] = arr[j-1] - 1;
                flag = true;
                break;
            }
        }
        if(!flag){
            cout<<"NO"<<endl;
            return 0;
        }
	}

    cout<<"YES"<<endl;
	for(int i = 1; i <= n; i++){
        cout<<arr[i]<<" ";
	}
	cout<<endl;

    return 0;
}


//BISMILLAHIR RAHMANIR RAHIM
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <list>
#define cos(a) cos(a*pi/180)
#define sin(a) sin(a*pi/180)
#define tan(a) tan(a*pi/180)
#define cosi(a) acos(a)/(pi/180)
#define sini(a) asin(a)/(pi/180)
#define tani(a) atan(a)/(pi/180)
#define mem(a, b) (memset(a, b, sizeof(a)))
#define read (freopen("input.txt", "r", stdin))
#define write (freopen("output.txt", "w", stdout))
#define fastIO (ios::sync_with_stdio(0), cin.tie(0), cout.tie(0));
#define dis(x1, y1, x2, y2) ((x1-x2) * (x1-x2)) + ((y1-y2) * (y1-y2))
#define debug (printf("PINK FLOYD:)\n"))
#define iosflags (cout<<setiosflags(ios::fixed)<<setprecision(8))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define pi 3.1415926535897932384
#define INF 2147483647
#define EPS 1e-8
#define MOD 1000000007
#define MAX 100005
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

const int inf = 1<<28;
int dirx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int diry[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
int dx[] = { -1, 1, 0, 0 };
int dy[] = { 0, 0, -1, 1 };
int fx[] = { -2, -2, -1, -1,  1,  1,  2,  2 };
int fy[] = { -1,  1, -2,  2, -2,  2, -1,  1 };

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

vii vp1, vp2;
int start[MAX], arr[MAX];

int main()
{
	fastIO;

	int n, m, t, l, r;

    cin>>n>>m;

	int k = 1e5;
	arr[0] = 1e5;
	k++;
	for(int i = 1; i <= n; i++){
        arr[i] = k++;
	}

	for(int i = 0; i < m; i++){
        cin>>t>>l>>r;
        if(t == 1){
            start[l] = 1;
            vp1.pb(mp(l, r));
        }
        else
            vp2.pb(mp(l, r));
	}

	for(int i = 0; i < vp2.size(); i++){
        for(int j = 0; j < vp1.size(); j++){
            if(vp2[i].ff >= vp1[i].ff && vp2[i].ss <= vp1[i].ss){
                cout<<"NO"<<endl;
                return 0;
            }
        }
	}

	for(int i = 0; i < vp2.size(); i++){
        for(int j = vp2[i].ff; j <= vp2[i].ss; j++){
            if(start[j]){
                arr[j] = arr[j-1] - 1;
            }
        }
	}

	for(int i = 1; i <= n; i++){
        cout<<arr[i]<<" ";
	}
	cout<<endl;

    return 0;
}


//...author:MAUNIE...//
#include<bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  vector<bool> s(n);
  vector<int> t(m), l(m), r(m);
  for (int i = 0; i < n; i++) {
      a[i] = 0;
  }
  for (int i = 0; i < m; i++) {
      cin >> t[i] >> l[i] >> r[i];
      l[i]--;
      r[i]--;
      if (t[i]) {
          for (int j = l[i] + 1; j <= r[i]; j++) {
              s[j] = true;
          }
      }
  }
  for (int i = 0; i < n; i++) {
      if (s[i]) {
          a[i] = a[i - 1];
      }
      else {
          a[i] = a[i - 1] - 1;
      }
  }
  int k = 1e9;
  for (int i = 0; i < n; i++) {
      k = min(k, a[i]);
  }
  if (k <= 0) {
      for (int i = 0; i < n; i++) {
          a[i] += abs(k);
          a[i]++;
      }
  }
  for (int i = 0; i < m; i++) {
      bool sorted = true;
      for (int j = l[i] + 1; j <= r[i]; j++) {
          if (a[j] < a[j - 1]) {
              sorted = false;
          }
      }
      if (sorted != t[i]) {
          cout << "NO";
          return 0;
      }
  }
  cout << "YES" << '\n';
  for (int i = 0; i < n; i++) {
      cout << a[i] << " ";
  }
  return 0;
}


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

#define ll long long
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0)
#define f first
#define se second
#define lb lower_bound
#define ub upper_bound
#define pii pair<int, int>

const int N = 2e5 + 1000, mod = 1e9 + 7;
int n, m, a[2000], c[2000];
vector <int> vec[30];
pii b[2000];
int v[2000];
int y[2000];

ll bin_pow(int x, int y){
    if(y == 0)
        return 1;
    if(y == 1)
        return x;
    if(y % 2 == 0){
        ll z = bin_pow(x, y / 2);
        return (z * z) % mod;
    }
    return (bin_pow(x, y - 1) * x) % mod;
}

bool check(int x){

}

int main(){
    boost;
    cin >> n >> m;
    int p = 1, q = 0, g = 0;
    for(int i = 1; i <= n; i++){
        y[i] = 1e8;
    }
    for(int j = 1; j <= m; j++){
        int t, l, r;
        cin >> t;
        if(t == 1){
            cin >> l >> r;
            int lx = l, rx = r;
            for(int i = l; i <= r; i++){
                if(a[i] != 0){
                    lx = min(lx,  y[a[i]]);
                    rx = max(rx, v[a[i]]);
                }
            }
            v[p] = rx;
            y[p] = lx;
            for(int i = lx; i <= rx; i++){
                a[i] = p;
            }
            p++;
        }else{
            q++;
            cin >> b[q].f >> b[q].se;
        }
    }

    for(int i = 1; i <= q; i++){
        bool ok = false;
        for(int j = b[i].f + 1; j <= b[i].se; j++){
            if(c[j] == -1){
                ok = true;
                break;
            }
        }
        if(!ok)
            for(int j = b[i].f + 1; j <= b[i].se; j++){
                if(a[j - 1] != a[j] || a[j] == 0){
                    ok = true;
                    c[j] = -1;
                }
            }
        if(!ok){
            cout << "NO";
            return 0;
        }
    }

    cout << "YES\n";
    int k = 2000;
    for(int i = 1; i <= n; i++){
        if(c[i] < 0){
            k--;
        }
        cout << k << " ";
    }
    return 0;
}


//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int nax=1000*1007;

int n, m;

int tab[nax];

int per[nax];

vector <pii> nope;

int czy(int a, int b)
{
	for (int i=a; i<b; i++)
		if (per[i]>per[i+1])
			return 0;
	return 1;
}

int main()
{
	scanf("%d%d", &n, &m);
	for (int i=1; i<=m; i++)
	{
		int t, a, b;
		scanf("%d%d%d", &t, &a, &b);
		if (t)
		{
			tab[a]++;
			tab[b]--;
		}
		else
		{
			nope.push_back({a, b});
		}
	}
	for (int i=1; i<=n; i++)
		tab[i]+=tab[i-1];
	int k=2*n;
	int v=1;
	while(v<=n)
	{
		int w=0;
		while(tab[v+w])
			w++;
		k--;
		for (int i=0; i<=w; i++)
			per[v+i]=k;
		v+=w+1;
	}
	debug() << range(per+1, per+1+n) << nope;
	for (pii i : nope)
	{
		if (czy(i.first, i.second))
		{
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	for (int i=1; i<=n; i++)
		printf("%d ", per[i]);
	printf("\n");
	return 0;
}


#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#include <stdio.h>//sprintf islower is upper
#include <cstdlib>////malloc  exit strcat itoa system("cls")
#include <iostream>//pair
#include <fstream>
#include <bitset>
//#include <map>
#include <vector>
#include <stack>
#include <set>
#include <string.h>//strstr
#include <string>
#include <time.h>//srand(((unsigned)time(NULL))); Seed n=rand()%10 - 0~9;
#include <cmath>
#include <deque>
#include <queue>//priority_queue<int, vector<int>, greater<int> > q;//less
#include <vector>//emplace_back
//#include <math.h>
//#include <windows.h>//reverse(a,a+len);// ~ ! ~ ! floor
#include <algorithm>//sort + unique : sz=unique(b+1,b+n+1)-(b+1);+nth_element(first, nth, last, compare)
using namespace std;//next_permutation(a+1,a+1+n);//prev_permutation
#define mem(a,b) memset(a,b,sizeof(a))
#define fo(a,b,c) for(a=b;a<=c;++a)//register int i
#define fr(a,b,c) for(a=b;a>=c;--a)
#define pr printf
#define sc scanf
void swapp(int &a,int &b);
double fabss(double a);
int maxx(int a,int b);
int minn(int a,int b);
int Del_bit_1(int n);
int lowbit(int n);
int abss(int a);
//const long long INF=(1LL<<60);
const double E=2.718281828;
const double PI=acos(-1.0);
const int inf=(1<<29);
const double ESP=1e-6;
const int mod=(int)1e9+7;
const int N=(int)1e6+6;

int mark[N];
int k[N],a[N],b[N];

int main()
{
	int n,m;
	sc("%d%d",&n,&m);
	for(int i=1;i<=n;++i)
		mark[i]=-1;
	for(int i=1;i<=m;++i)
	{
		sc("%d%d%d",&k[i],&a[i],&b[i]);
		if(k[i]==1)
		{
			for(int j=a[i]+1;j<=b[i];++j)
				mark[j]=1;
		}
	}
	for(int i=1;i<=m;++i)
	{
		if(k[i]==0)
		{
			bool f=0;
			for(int j=a[i]+1;j<=b[i];++j)
			{
				if(mark[j]!=1)
				{
					mark[j]=0;
					f=1;
					break;
				}
			}
			if(!f)
			{
				pr("NO\n");
				return 0;
			}
		}
	}
	int start=10000;
	pr("YES\n");
	pr("%d ",start);
	for(int i=2;i<=n;++i)
	{
		if(mark[i]==0)
			start--;
		pr("%d\n",start);
	}
	return 0;
}

/**************************************************************************************/

int maxx(int a,int b)
{
	return a>b?a:b;
}

void swapp(int &a,int &b)
{
	a^=b^=a^=b;
}

int lowbit(int n)
{
	return n&(-n);
}

int Del_bit_1(int n)
{
	return n&(n-1);
}

int abss(int a)
{
	return a>0?a:-a;
}

double fabss(double a)
{
	return a>0?a:-a;
}

int minn(int a,int b)
{
	return a<b?a:b;
}


#include <bits/stdc++.h>
using namespace std;
int n,m,t,l,r;
int a[1010];
int b[1010];
vector<pair<int,int>> t0,t1;
int main() {
    scanf("%d %d",&n,&m);
    while(m--) {
        scanf("%d %d %d",&t,&l,&r);
        if (t) t1.push_back({l-1,r-1});
        else t0.push_back({l-1,r-1});
    }
    for (auto p:t1) {
        int x = p.first;
        int y = p.second;
        for (int i=x; i<y; i++) b[i] = 1;
    }
    for (auto p:t0) {
        bool ans = false;
        int x = p.first;
        int y = p.second;
        for (int i=x; i<y; i++) {
            if (b[i]!=1&&ans==false) {
                ans = true;
                b[i]=2;
            }
        }
        if (ans==false) {
            printf("NO");
            return 0;
        }
    }
    //for (int i=0; i<n; i++) printf("%d ",b[i]);
    if (b[0]!=2) a[0] = 0;
    else a[0]=1;
    for (int i=0; i<n-1; i++) {
        if (b[i]==2) a[i+1]=a[i]-1;
    }
    printf("YES\n");
    for (int i=0; i<n; i++) printf("%d ",a[i]+10000);
}


#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

int main()
{
    int n, m, last = 5000;
    bool ans=1;
    cin >> n >> m;
    vector <bool> arr(n, 0);
    vector <pair <int, int>> nonsorted;
    arr[0]=1;
    for (int i=0; i<m; i++) {
        int l, r, t;
        cin >> t >> l >> r;
        if (t) {
            for (int i=l; i<r; i++) {
                arr[i]=1;
            }
        }
        else {
            nonsorted.push_back({l, r});
        }
    }
    for (auto p:nonsorted) {
        int l = p.first, r = p.second;
        bool indicator=0;
        for (int i=l; i<r; i++) {
            if (!arr[i]) indicator = 1;
        }
        if (!indicator)
            ans=0;
    }
    if (!ans)
        cout << "NO";
    else {
        cout << "YES\n";
        for (int i=0; i<n; i++) {
            if (arr[i]==1) {
                cout << last+1 << " ";
                last++;
            }
            else {
                cout << last-1 << " ";
                last--;
            }
        }
    }
    return 0;
}


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

#ifdef DEBUG
#define n_l '\n'
#define dbg(...) cout << "[" << #__VA_ARGS__ << "]: "; cout << to_string(__VA_ARGS__) << endl
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(const string s, int x1=0, int x2=1e9){ return '"' + ((x1 < (int) s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(const bool b) { return (b ? "true" : "false"); } string to_string(const char c){ return string({c}); } template<size_t N> string to_string(const bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)),  __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(const A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(const pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(const A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += n_l; return res; } void dbgm(){;} template<typename Heads, typename... Tails> void dbgm(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgm(T...); }
#define dbgm(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl
#else
#define dbg(...) ;
#define dbgm(...) ;
#endif

#define endl "\n"
const int INF = 0x3f3f3f3f;

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - (((begin) > (end)) << 1))

#define all(X) begin(X),end(X)
#define rall(v) v.rbegin(),v.rend()
#define sz(x) ((int) x.size())

//#define MEM_EATER
#ifndef MEM_EATER
#define rd1(x) scanf("%d", &x)
#define rd2(x, y) scanf("%d%d", &x, &y)
#define rd3(x, y, z) scanf("%d%d%d", &x, &y, &z)
#else
#define int ll
#define rd1(x) scanf("%lld", &x)
#define rd2(x, y) scanf("%lld%lld", &x, &y)
#define rd3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z)
#endif

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef map<int,int> mii;
typedef map<string,int> msi;

#define rdl1(x) scanf("%l64d", &x)
#define rdl2(x, y) scanf("%l64d%l64d", &x, &y)
#define rdl3(x, y, z) scanf("%l64d%l64d%l64d", &x, &y, &z)

#pragma GCC optimize ("Ofast")
#pragma GCC target("avx,avx2")

void fail() {
	cout << "NO" << endl;
	exit(0);
}

int32_t main() {

#ifdef DEBUG
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
	int n,m; rd2(n,m);
	vi a(n);
	vii b[2];
	rep(i,0,m) {
		int t,l,r; rd3(t,l,r);
		l--; r--;
		b[t].push_back({l,r});
	}

	vb tt(n, false);
	for(ii& x : b[1])
		rep(i,x.first+1,x.second+1)
			tt[i] = true;

	for(ii& x : b[0]) {
		rep(i,x.first+1,x.second+1)
			if(!tt[i])
				goto THERE;
		fail();
THERE:;
	}

	a[0] = 2000;
	rep(i,1,n) {
		if(tt[i])
			a[i] = a[i-1]+1;
		else
			a[i] = a[i-1]-1;
	}

	cout << "YES" << endl;
	for(int& i : a)
		cout << i << " ";
	cout << endl;

	return 0;
}


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

const int N = 1000;
bool t[N + 10];
int l[N + 10], r[N + 10], dp[N + 10], sum[N + 10];

int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++)
        cin >> t[i] >> l[i] >> r[i];
    for (int i = 0; i < n; i++)
        dp[i] = i;
    for (int i = 0 ; i < m; i++)
        if(t[i])
            for(int j = l[i] - 1; j < r[i]; j++)
                dp[j] = min(dp[j], l[i] - 1);
    for (int i = 0; i < n; i++)
        dp[i] = min(dp[i], dp[dp[i]]);
    bool ans = 1;
    for (int i = 0; i < m; i++)
        if(!t[i])
            if(dp[r[i] - 1] <= l[i] - 1)
                ans = 0;
    if(ans) {
        int z = 0;
        for (int i = 0; i < n; i++) {
            if(dp[i] < i) {
                sum[i] = sum[i - 1] + 1;
            }
            else {
                sum[i] = sum[i - 1] - 1;
            }
        }
        int x = sum[0];
        for (int i = 1; i < n; i++)
            x = min(x, sum[i]);
        if(x <= 0)
            for (int i = 0; i < n; i++)
                sum[i] += abs(x) + 1;
    }
    if(ans) {
        cout << "YES" << endl;
        for (int i = 0; i < n; i++)
            cout << sum[i] << " ";
    }
    else
        cout << "NO";
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <string>
#include <iomanip>
#include <set>
#include <map>
#include <queue>
#include <stack>

using namespace std;

typedef long long li;
typedef unsigned long long uli;
typedef pair<int, int> pii;
typedef long double ld;

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define fr first
#define sc second
#define pb push_back
#define forn(i, n) for(int i = 0; i < int(n); ++i)
#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
#define forb(i, n) for(int i = int(n) - 1; i >= 0; --i)

const int INF = 1e9 + 1000;
const li INF64 = 1e15 + 1000;
const int M = 26;
const int N = 3 * 1000 + 100;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = 3.14159265359;

li gcd(li a, li b) {
    return a == 0 ? b : gcd(b % a, a);
}

vector<int> a[M];

int main() {
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, m;
    cin >> n >> m;

    vector<int> t(m), l(m), r(m);
    forn(i, m) {
        cin >> t[i] >> l[i] >> r[i];
        l[i]--;
        r[i]--;
    }

    vector<int> a(n);

    a[0] = 1e8;
    fore(i, 1, n) {
        a[i] = a[i - 1] - int(1e4);
    }

    vector<pii> e;
    forn(i, m) {
        if (t[i] == 1) {
            e.pb({ l[i], -1 });
            e.pb({ r[i], 1 });
        }
    }

    sort(all(e));

    vector<int> l1, r1;
    int st;
    int curr = 0;
    for (auto e0 : e) {
        if (curr == 0) {
            st = e0.fr;
        }
        curr -= e0.sc;
        if (curr == 0) {
            l1.pb(st);
            r1.pb(e0.fr);
        }
    }

    forn(i, l1.size()) {
        fore(j, l1[i] + 1, r1[i] + 1) {
            a[j] = a[j - 1] + 1;
        }
    }

    forn(i, m) {
        if (t[i] == 0) {
            bool q = false;
            fore(j, l[i] + 1, r[i] + 1) {
                if (a[j - 1] > a[j]) {
                    q = true;
                    break;
                }
            }
            if (!q) {
                cout << "NO\n";
                return 0;
            }
        }
    }

    cout << "YES\n";
    forn(i, n) {
        cout << a[i] << ' ';
    }
    cout << '\n';

}