#include <bits/stdc++.h>
#define ll long long int

using namespace std;

const int N = 10005;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    int m;
    cin >> m;
    vector<pair<int,int>> s,us;
    for(int i=0;i<m;i++)
    {
        int t,l,r;
        cin >> t >> l >> r;
        l--,r--;
        if(t)
            s.push_back({l,r});
        else
            us.push_back({l,r});
    }
    ll ans[n+5] = {0};
    sort(s.begin(),s.end());
    sort(us.begin(),us.end());
    for(auto x : s)
    {
        int l = x.first;
        int r = x.second;
        for(auto &y : us)
        {
            bool bad = false;
            if(y.first >= l && y.second <= r)
                bad = 1;
            if(y.first >= l && y.first <= r)
            {
                y.first = r;
            }
            if(y.second >= l && y.second <= r)
            {
                y.second = l;
            }
            if(y.first >= y.second)
                bad = 1;
            if(bad)
            {
                cout << "NO";
                return 0;
            }
        }
    }
    for(int i=0;i<n;i++)
        ans[i] = 2*n+5;
    sort(us.begin(),us.end());
    for(auto x : us)
    {
        int l = x.first;
        int r = x.second;
        ll val = ans[l];
        for(int i=l;i<=r;i++)
        {
            ans[i] = val;
            val--;
        }
    }
    cout << "YES\n";
    for(int i=0;i<n;i++)
    {
         cout << ans[i] << " ";
    }
}


#include <bits/stdc++.h>
#define ll long long int

using namespace std;

const int N = 10005;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    int m;
    cin >> m;
    vector<pair<int,int>> s,us;
    for(int i=0;i<m;i++)
    {
        int t,l,r;
        cin >> t >> l >> r;
        l--,r--;
        if(t)
            s.push_back({l,r});
        else
            us.push_back({l,r});
    }
    ll ans[n+5] = {0};
    for(auto x : s)
    {
        int l = x.first;
        int r = x.second;
        for(auto &y : us)
        {
            bool bad = false;
            if(y.first >= l && y.second <= r)
                bad = 1;
            if(y.first >= l && y.first <= r)
            {
                y.first = r;
            }
            if(y.second >= l && y.second <= r)
            {
                y.second = l;
            }
            if(y.first >= y.second)
                bad = 1;
            if(bad)
            {
                cout << "NO";
                return 0;
            }
            //cout << l << " " << r << " " << y.first << " " << y.second << "\n";
        }
    }
    for(int i=0;i<n;i++)
        ans[i] = 2*n+5;
    sort(us.begin(),us.end());
    for(auto x : us)
    {
        int l = x.first;
        int r = x.second;
        ll val = ans[l];
        for(int i=l;i<=r;i++)
        {
            ans[i] = val;
            val--;
        }
    }
    cout << "YES\n";
    for(int i=0;i<n;i++)
    {
        if(ans[i])
            cout << ans[i] << " ";
        else
            cout << 1 << " ";
    }
}


#include <bits/stdc++.h>
#define ll long long int

using namespace std;

const int N = 10005;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    int m;
    cin >> m;
    vector<pair<int,int>> s,us;
    vector<pair<pair<int,int>,int>> v;
    for(int i=0;i<m;i++)
    {
        int t,l,r;
        cin >> t >> l >> r;
        l--,r--;
        v.push_back({{l,t^1},r});
        if(t)
        s.push_back({l,r});
        else
        us.push_back({l,r});
    }
    sort(v.begin(),v.end());
    int f = 0;
    int ans[n+5] = {0};
    bool yes = true;
    for(auto x : s)
    {
        int l = x.first;
        int r = x.second;
        for(auto y : us)
        {
            bool bad = false;
            if(y.first >= l && y.second <= r)
                bad = 1;
            else if(y.first >= l && y.first < r)
            {
                y.first = r;
            }
            else if(y.second > l && y.second <= r)
                y.second = l;
            if(y.first == y.second)
                bad = 1;
            if(bad)
            {
                cout << "NO";
                return 0;
            }
        }
    }
    int rmax = -1;
    for(auto x : v)
    {
        int l = x.first.first;
        int t = x.first.second;
        int r = x.second;
        if(t==0)
        {
            for(int i=max(l,rmax);i<=r;i++)
                ans[i] = n+10000;
            rmax = max(rmax,r);
        }
        else
        {
            ll val = n+10000;
            for(int i=max(l,rmax);i<=r;i++)
            {
                ans[i] = val;
                val--;
            }
            rmax = max(rmax,r+1);
        }
    }
    cout << "YES\n";
    for(int i=0;i<n;i++)
    {
        if(ans[i])
            cout << ans[i] << " ";
        else
            cout << 1 << " ";
    }
}


#include <bits/stdc++.h>
#define ll long long int

using namespace std;

const int N = 10005;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    int m;
    cin >> m;
    vector<pair<int,int>> s,us;
    vector<pair<pair<int,int>,int>> v;
    for(int i=0;i<m;i++)
    {
        int t,l,r;
        cin >> t >> l >> r;
        l--,r--;
        v.push_back({{l,r},t});
        if(t)
        s.push_back({l,r});
        else
        us.push_back({l,r});
    }
    sort(v.begin(),v.end());
    int f = 0;
    int ans[n+5] = {0};
    bool yes = true;
    for(auto x : s)
    {
        int l = x.first;
        int r = x.second;
        for(auto y : us)
        {
            bool bad = false;
            if(y.first > l && y.first < r)
                bad = 1;
            if(y.second > l && y.second < r)
                bad = 1;
            if(y.first <= l && y.second >= r)
                bad = 1;
            if(bad)
            {
                cout << "NO";
                return 0;
            }
        }
        for(int i=l;i<=r;i++)
            ans[i] = n+5;
    }
    for(int i=0;i<n;i++)
    {
        if(!ans[i])
        {
            int val = n+4;
            while(!ans[i])
            {
                ans[i] = val;
                val--;
                i++;
            }
        }
    }
    cout << "YES\n";
    for(auto x : us)
    {
        int l = x.first ;
        int r = x.second;
        int val;
        for(int i=l;i<=r;i++)
        {
            if(i == l)
                val = ans[i];
            else
            {
                val--;
                ans[i] = val;
            }
        }
    }
    for(int i=0;i<n;i++)
        cout << ans[i] << " ";
}


#include <bits/stdc++.h>
#define ll long long int

using namespace std;

const int N = 10005;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    int m;
    cin >> m;
    vector<pair<int,int>> s,us;
    vector<pair<pair<int,int>,int>> v;
    for(int i=0;i<m;i++)
    {
        int t,l,r;
        cin >> t >> l >> r;
        l--,r--;
        if(t)
        s.push_back({l,r});
        else
        us.push_back({l,r});
    }
    int f = 0;
    int ans[n+5] = {0};
    bool yes = true;
    for(auto x : s)
    {
        int l = x.first;
        int r = x.second;
        for(auto y : us)
        {
            bool bad = false;
            if(y.first >= l && y.second <= r)
                bad = 1;
            else if(y.first >= l && y.first < r)
            {
                y.first = r;
            }
            else if(y.second > l && y.second <= r)
                y.second = l;
            if(y.first >= y.second)
                bad = 1;
            if(bad)
            {
                cout << "NO";
                return 0;
            }
        }
    }
    int rmax = -1;
    for(auto x : s)
    {
        int l = x.first;
        int r = x.second;
        v.push_back({{l,0},r});
    }
    for(auto x : us)
    {
        int l = x.first;
        int r = x.second;
        v.push_back({{l,1},r});
    }
    sort(v.begin(),v.end());
    for(auto x : v)
    {
        int l = x.first.first;
        int t = x.first.second;
        int r = x.second;
        //cout << l << " " << r << " " << t << "\n";
        if(t==0)
        {
            for(int i=max(l,rmax);i<=r;i++)
                ans[i] = n+10000;
            rmax = max(rmax,r);
        }
        else
        {
            ll val = n+10000;
            for(int i=max(l,rmax);i<=r;i++)
            {
                ans[i] = val;
                val--;
            }
            rmax = max(rmax,r+1);
        }
    }
    cout << "YES\n";
    for(int i=0;i<n;i++)
    {
        if(ans[i])
            cout << ans[i] << " ";
        else
            cout << 1 << " ";
    }
}


#include <bits/stdc++.h>
#define ll long long int

using namespace std;

const int N = 10005;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    int m;
    cin >> m;
    vector<pair<int,int>> s,us;
    for(int i=0;i<m;i++)
    {
        int t,l,r;
        cin >> t >> l >> r;
        l--,r--;
        if(t)
            s.push_back({l,r});
        else
            us.push_back({l,r});
    }
    ll ans[n+5] = {0};
    sort(s.begin(),s.end());
    sort(us.begin(),us.end());
    for(auto x : s)
    {
        int l = x.first;
        int r = x.second;
        for(auto &y : us)
        {
            bool bad = false;
            if(y.first >= l && y.second <= r)
                bad = 1;
            if(y.first >= l && y.first <= r)
                y.first = r;
            if(y.second >= l && y.second <= r)
                y.second = l;
            if(y.first >= y.second)
                bad = 1;
            if(bad)
            {
                cout << "NO";
                return 0;
            }
        }
    }
    for(int i=0;i<n;i++)
        ans[i] = 2*n+5;
    sort(us.begin(),us.end());
    for(auto x : us)
    {
        int l = x.first;
        int r = x.second;
        ll val = ans[l];
        for(int i=l;i<=l+1;i++)
        {
            ans[i] = val;
            val--;
        }
    }
    cout << "YES\n";
    for(int i=0;i<n;i++)
    {
         cout << ans[i] << " ";
    }
}


#include <bits/stdc++.h>
#define ll long long int

using namespace std;

const int N = 10005;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    int m;
    cin >> m;
    vector<pair<int,int>> s,us;
    vector<pair<pair<int,int>,int>> v;
    for(int i=0;i<m;i++)
    {
        int t,l,r;
        cin >> t >> l >> r;
        l--,r--;
        v.push_back({{l,t^1},r});
        if(t)
        s.push_back({l,r});
        else
        us.push_back({l,r});
    }
    sort(v.begin(),v.end());
    int f = 0;
    int ans[n+5] = {0};
    bool yes = true;
    for(auto x : s)
    {
        int l = x.first;
        int r = x.second;
        for(auto y : us)
        {
            bool bad = false;
            if(y.first >= l && y.second <= r)
                bad = 1;
            else if(y.first >= l && y.first < r)
            {
                y.first = r;
            }
            else if(y.second > l && y.second <= r)
                y.second = l;
            if(bad)
            {
                cout << "NO";
                return 0;
            }
        }
        for(int i=l;i<=r;i++)
            ans[i] = n+5;
    }
    int rmax = -1;
    for(auto x : v)
    {
        int l = x.first.first;
        int t = x.first.second;
        int r = x.second;
        if(t == 0)
        {
            for(int i=max(l,rmax+1);i<=r;i++)
            {
                ans[i] = n+5;
            }
        }
        else
        {
            int val = ans[rmax];
            for(int i=max(rmax,l);i<=r;i++)
            {
                ans[i] = val;
                val--;
            }
        }
        //cout << t <<  " " << l << " " << r <<  " " << rmax  << "\n";
        rmax = max(r,rmax);
    }
    cout << "YES\n";
    for(int i=0;i<n;i++)
    {
        if(ans[i])
            cout << ans[i] << " ";
        else
            cout << 1 << " ";
    }
}


#include <bits/stdc++.h>
#define ll long long int

using namespace std;

const int N = 10005;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    int m;
    cin >> m;
    vector<pair<int,int>> s,us;
    vector<pair<pair<int,int>,int>> v;
    for(int i=0;i<m;i++)
    {
        int t,l,r;
        cin >> t >> l >> r;
        l--,r--;
        v.push_back({{l,t^1},r});
        if(t)
        s.push_back({l,r});
        else
        us.push_back({l,r});
    }
    sort(v.begin(),v.end());
    int f = 0;
    int ans[n+5] = {0};
    bool yes = true;
    for(auto x : s)
    {
        int l = x.first;
        int r = x.second;
        for(auto y : us)
        {
            bool bad = false;
            if(y.first >= l && y.second <= r)
                bad = 1;
            else if(y.first >= l && y.first < r)
            {
                y.first = r;
            }
            else if(y.second > l && y.second <= r)
                y.second = l;
            if(y.first >= y.second)
                bad = 1;
            if(bad)
            {
                cout << "NO";
                return 0;
            }
        }
    }
    int rmax = -1;
    for(auto x : v)
    {
        int l = x.first.first;
        int t = x.first.second;
        int r = x.second;
        if(t==0)
        {
            for(int i=max(l,rmax);i<=r;i++)
                ans[i] = n+10000;
            rmax = max(rmax,r);
        }
        else
        {
            ll val = n+10000;
            for(int i=max(l,rmax);i<=r;i++)
            {
                ans[i] = val;
                val--;
            }
            rmax = max(rmax,r+1);
        }
    }
    cout << "YES\n";
    for(int i=0;i<n;i++)
    {
        if(ans[i])
            cout << ans[i] << " ";
        else
            cout << 1 << " ";
    }
}


#include <bits/stdc++.h>
#define ll long long int

using namespace std;

const int N = 10005;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    int m;
    cin >> m;
    vector<pair<int,int>> s,us;
    vector<pair<pair<int,int>,int>> v;
    for(int i=0;i<m;i++)
    {
        int t,l,r;
        cin >> t >> l >> r;
        l--,r--;
        if(t)
            s.push_back({l,r});
        else
            us.push_back({l,r});
    }
    int f = 0;
    int ans[n+5] = {0};
    bool yes = true;
    for(auto x : s)
    {
        int l = x.first;
        int r = x.second;
        for(auto &y : us)
        {
            bool bad = false;
            if(y.first >= l && y.second <= r)
                bad = 1;
            if(y.first >= l && y.first <= r)
            {
                //cout << l << " " << r << " " << y.first << " " << y.second << " here\n";
                y.first = r;
            }
            if(y.second >= l && y.second <= r)
            {
                //cout << l << " " << r << " " << y.first << " " << y.second << " here2\n";
                y.second = l;
            }
            if(y.first >= y.second)
                bad = 1;
            if(bad)
            {
                cout << "NO";
                return 0;
            }
            //cout << l << " " << r << " " << y.first << " " << y.second << "\n";
        }
    }
    int rmax = -1;
    for(auto x : s)
    {
        int l = x.first;
        int r = x.second;
        v.push_back({{l,0},r});
    }
    for(auto x : us)
    {
        int l = x.first;
        int r = x.second;
        v.push_back({{l,1},r});
    }
    sort(v.begin(),v.end());
    for(int i=0;i<n;i++)
        ans[i] = n+5;
    for(auto x : us)
    {
        int l = x.first;
        int r = x.second;
        int val = ans[l];
        for(int i=l;i<=r;i++)
        {
            ans[i] = val;
            val--;
        }
    }
    cout << "YES\n";
    for(int i=0;i<n;i++)
    {
        if(ans[i])
            cout << ans[i] << " ";
        else
            cout << 1 << " ";
    }
}


#include <bits/stdc++.h>
#define ll long long int

using namespace std;

const int N = 10005;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    int m;
    cin >> m;
    vector<pair<int,int>> s,us;
    vector<pair<pair<int,int>,int>> v;
    for(int i=0;i<m;i++)
    {
        int t,l,r;
        cin >> t >> l >> r;
        l--,r--;
        v.push_back({{l,t^1},r});
        if(t)
        s.push_back({l,r});
        else
        us.push_back({l,r});
    }
    sort(v.begin(),v.end());
    int f = 0;
    int ans[n+5] = {0};
    bool yes = true;
    for(auto x : s)
    {
        int l = x.first;
        int r = x.second;
        for(auto y : us)
        {
            bool bad = false;
            if(y.first >= l && y.second <= r)
                bad = 1;
            if(bad)
            {
                cout << "NO";
                return 0;
            }
        }
        for(int i=l;i<=r;i++)
            ans[i] = n+5;
    }
    int rmax = -1;
    for(auto x : v)
    {
        int l = x.first.first;
        int t = x.first.second;
        int r = x.second;
        if(t == 0)
        {
            for(int i=max(l,rmax+1);i<=r;i++)
            {
                ans[i] = n+5;
            }
        }
        else
        {
            int val = ans[rmax];
            for(int i=max(rmax,l);i<=r;i++)
            {
                ans[i] = val;
                val--;
            }
        }
        //cout << t <<  " " << l << " " << r <<  " " << rmax  << "\n";
        rmax = max(r,rmax);
    }
    cout << "YES\n";
    for(int i=0;i<n;i++)
    {
        if(ans[i])
            cout << ans[i] << " ";
        else
            cout << 1 << " ";
    }
}


#include <bits/stdc++.h>
#define ll long long int

using namespace std;

const int N = 10005;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    int m;
    cin >> m;
    vector<pair<int,int>> s,us;
    vector<pair<pair<int,int>,int>> v;
    for(int i=0;i<m;i++)
    {
        int t,l,r;
        cin >> t >> l >> r;
        l--,r--;
        v.push_back({{l,t^1},r});
        if(t)
        s.push_back({l,r});
        else
        us.push_back({l,r});
    }
    sort(v.begin(),v.end());
    int f = 0;
    int ans[n+5] = {0};
    bool yes = true;
    for(auto x : s)
    {
        int l = x.first;
        int r = x.second;
        for(auto y : us)
        {
            bool bad = false;
            if(y.first >= l && y.second <= r)
                bad = 1;
            else if(y.first >= l && y.first < r)
            {
                y.first = r;
            }
            else if(y.second > l && y.second <= r)
                y.second = l;
            if(bad)
            {
                cout << "NO";
                return 0;
            }
        }
    }
    int rmax = -1;
    for(auto x : v)
    {
        int l = x.first.first;
        int t = x.first.second;
        int r = x.second;
        if(t==0)
        {
            for(int i=max(l,rmax);i<=r;i++)
                ans[i] = n+10000;
            rmax = max(rmax,r);
        }
        else
        {
            ll val = n+10000;
            for(int i=max(l,rmax);i<=r;i++)
            {
                ans[i] = val;
                val--;
            }
            rmax = max(rmax,r+1);
        }
    }
    cout << "YES\n";
    for(int i=0;i<n;i++)
    {
        if(ans[i])
            cout << ans[i] << " ";
        else
            cout << 1 << " ";
    }
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define mid (l+r)/2
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<"---"<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
const int maxn=1e3+10;
int a[maxn];
int n,m;

struct seg{
	int f,l,r;
	bool operator<(const seg &u)const{
		if(l!=u.l)return l<u.l;
		return r<u.r;
	}
}b[maxn];

bool check(int l,int r){
	for(int i=l+1;i<=r;i++)if(a[i]<a[i-1])return false;
	return true;
}

int main(){
	io;
	cin>>n>>m;
	for(int i=1;i<=m;i++)cin>>b[i].f>>b[i].l>>b[i].r;
	sort(b+1,b+1+m);
	bool flag=true;
	for(int i=1;i<=m;i++){
		if(!flag)break;
		if(b[i].f){
			if(a[b[i].l]){
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++){
					if(a[j]){  x=a[j]; }
					else a[j]=x;
				}
			}
			else {
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++)a[j]=x++;
			}
		}
		else {
			if(a[b[i].r]&&check(b[i].l,b[i].r)){ flag=false;break; }
			bool ok=false;
			for(int j=b[i].l+1;j<=b[i].r;j++)
				if(a[j]&&a[j]<a[j-1]){ ok=true;break; }
			if(!ok){
				if(!a[b[i].l]){ a[b[i].l]=2001;a[b[i].l+1]=2000;ok=true;break; }
				for(int j=b[i].l+1;j<=b[i].r;j++)
					if(!a[j]){ a[j]=a[j-1]-1;ok=true;break; }
			}
			if(!ok)flag=false;
		}
	}
	if(!flag){ cout<<"NO"<<endl;return 0; }
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++){
		if(i!=1)cout<<" ";
		cout<<(a[i]?a[i]:2000);
	}
	cout<<endl;
	return 0;
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define mid (l+r)/2
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<"---"<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
const int maxn=1e3+10;
int a[maxn];
int n,m;

struct seg{
	int f,l,r;
	bool operator<(const seg &u)const{
		if(f!=u.f)return f>u.f;
		else {
			if(l!=u.l)return l<u.l;
			return r<u.r;
		}
	}
}b[maxn];

bool check(int l,int r){
	for(int i=l+1;i<=r;i++)if(a[i]<a[i-1])return false;
	return true;
}

int main(){
	io;
	cin>>n>>m;
	for(int i=1;i<=m;i++)cin>>b[i].f>>b[i].l>>b[i].r;
	sort(b+1,b+1+m);
	bool flag=true;
	for(int i=1;i<=m;i++){
		if(!flag)break;
		if(b[i].f){
			if(a[b[i].l]){
				for(int j=b[i].l+1;j<=b[i].r;j++){
					if(a[j]){ if(a[j]<a[j-1]){ flag=false;break; } }
					else a[j]=a[j-1]+2;
				}
			}
			else {
				int x=1000;
				for(int j=b[i].l;j<=b[i].r;j++){ a[j]=x+2;x+=2; }
			}
		}
		else {
			bool ok=false;
			for(int j=b[i].l;j<=b[i].r;j++)if(!a[j])ok=true;
			if(!ok&&check(b[i].l,b[i].r)){ flag=false;break; }
			if(!ok)continue;
			ok=false;
			for(int j=b[i].l;j<=b[i].r;j++)if(a[j])ok=true;
			if(!ok){ a[b[i].l]=5001;a[b[i].l+1]=5000; }
			else {
				if(!a[b[i].l])a[b[i].l]=5001;
				for(int j=b[i].l+1;j<=b[i].r;j++)if(!a[j])a[j]=a[j-1]-1;
			}
		}
	}
	if(!flag){ cout<<"NO"<<endl;return 0; }
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++){
		if(i!=1)cout<<" ";
		cout<<(a[i]?a[i]:2000);
	}
	cout<<endl;
	return 0;
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define mid (l+r)/2
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<"---"<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
const int maxn=1e3+10;
int a[maxn];
int n,m;

struct seg{
	int f,l,r;
	bool operator<(const seg &u)const{
		if(l!=u.l)return l<u.l;
		return r<u.r;
	}
}b[maxn];

bool check(int l,int r){
	for(int i=l+1;i<=r;i++)if(a[i]<a[i-1])return false;
	return true;
}

int main(){
	io;
	cin>>n>>m;
	for(int i=1;i<=m;i++)cin>>b[i].f>>b[i].l>>b[i].r;
	sort(b+1,b+1+m);
	bool flag=true;
	for(int i=1;i<=m;i++){
		if(!flag)break;
		if(b[i].f){
			if(a[b[i].l]){
				for(int j=b[i].l+1;j<=b[i].r;j++){
					if(a[j]);//{ if(a[j]<a[j-1]){ flag=false;break; } }
					else a[j]=a[j-1]+1;
				}
			}
			else {
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++)a[j]=x++;
			}
		}
		else {
			if(a[b[i].r]&&check(b[i].l,b[i].r)){ flag=false;break; }
			bool ok=false;
			for(int j=b[i].l+1;j<=b[i].r;j++)
				if(a[j]&&a[j]<a[j-1]){ ok=true;break; }
			if(!ok){
				if(!a[b[i].l]){ a[b[i].l]=2001;a[b[i].l+1]=2000;ok=true;break; }
				for(int j=b[i].l+1;j<=b[i].r;j++)
					if(!a[j]){ a[j]=a[j-1]-1;ok=true;break; }
			}
			if(!ok)flag=false;
		}
	}
	if(!flag){ cout<<"NO"<<endl;return 0; }
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++){
		if(i!=1)cout<<" ";
		cout<<(a[i]?a[i]:2000);
	}
	cout<<endl;
	return 0;
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define mid (l+r)/2
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<"---"<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
const int maxn=1e3+10;
int a[maxn];
int n,m;

struct seg{
	int f,l,r;
	bool operator<(const seg &u)const{
		return l<u.l;
	}
}b[maxn];

bool check(int l,int r){
	for(int i=l+1;i<=r;i++)if(a[i]<a[i-1])return false;
	return true;
}

int main(){
	io;
	cin>>n>>m;
	for(int i=1;i<=m;i++)cin>>b[i].f>>b[i].l>>b[i].r;
	sort(b+1,b+1+m);
	bool flag=true;
	for(int i=1;i<=m;i++){
		if(!flag)break;
		if(b[i].f){
			bool ok=false;
			for(int j=b[i].l;j<=b[i].r;j++)if(a[j]){ ok=true;break; }
			if(ok){
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++){
					if(a[j]){ if(a[j]<x){ flag=false;break; } x=a[j]; }
					else a[j]=x;
				}
			}
			else {
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++)a[j]=x++;
			}
		}
		else {
			if(a[b[i].r]&&check(b[i].l,b[i].r)){ flag=false;break; }
			bool ok=false;
			for(int j=b[i].l+1;j<=b[i].r;j++)
				if(!a[j]&&a[j]<a[j-1]){ ok=true;break; }
			if(!ok){
				if(!a[b[i].l]){ a[b[i].l]=2000;a[b[i].l+1]=1999;ok=true;break; }
				for(int j=b[i].l+1;j<=b[i].r;j++)
					if(!a[j]){ a[j]=a[j-1]-1;ok=true;break; }
			}
			flag=ok;
		}
	}
	if(!flag){ cout<<"NO"<<endl;return 0; }
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++){
		if(i!=1)cout<<" ";
		cout<<(a[i]?a[i]:1000);
	}
	cout<<endl;
	return 0;
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define mid (l+r)/2
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<"---"<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
const int maxn=1e3+10;
int a[maxn];
int n,m;

struct seg{
	int f,l,r;
	bool operator<(const seg &u)const{
		return l<u.l;
	}
}b[maxn];

bool check(int l,int r){
	for(int i=l+1;i<=r;i++)if(a[i]<a[i-1])return false;
	return true;
}

int main(){
	io;
	cin>>n>>m;
	for(int i=1;i<=m;i++)cin>>b[i].f>>b[i].l>>b[i].r;
	sort(b+1,b+1+m);
	bool flag=true;
	for(int i=1;i<=m;i++){
		if(!flag)break;
		if(b[i].f){
			bool ok=false;
			for(int j=b[i].l;j<=b[i].r;j++)if(a[j]){ ok=true;break; }
			if(ok){
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++){
					if(a[j]){ if(a[j]<x){ flag=false;break; } x=a[j]; }
					else a[j]=x;
				}
			}
			else {
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++)a[j]=x++;
			}
		}
		else {
			if(a[b[i].r]&&check(b[i].l,b[i].r)){ flag=false;break; }
			bool ok=false;
			for(int j=b[i].l+1;j<=b[i].r;j++)
				if(!a[j]&&a[j]<a[j-1]){ ok=true;break; }
			if(!ok){
				if(!a[b[i].l]){ a[b[i].l]=2000;a[b[i].l+1]=1999;ok=true;break; }
				for(int j=b[i].l+1;j<=b[i].r;j++)
					if(!a[j]){ a[j]=a[j-1]-1;ok=true;break; }
			}
			if(!ok)flag=false;
		}
	}
	if(!flag){ cout<<"NO"<<endl;return 0; }
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++){
		if(i!=1)cout<<" ";
		cout<<(a[i]?a[i]:2000);
	}
	cout<<endl;
	return 0;
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define mid (l+r)/2
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<"---"<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
const int maxn=1e3+10;
int a[maxn];
int n,m;

struct seg{
	int f,l,r;
	bool operator<(const seg &u)const{
		if(l!=u.l)return l<u.l;
		return r<u.r;
	}
}b[maxn];

bool check(int l,int r){
	for(int i=l+1;i<=r;i++)if(a[i]<a[i-1])return false;
	return true;
}

int main(){
	io;
	cin>>n>>m;
	for(int i=1;i<=m;i++)cin>>b[i].f>>b[i].l>>b[i].r;
	sort(b+1,b+1+m);
	bool flag=true;
	for(int i=1;i<=m;i++){
		if(!flag)break;
		if(b[i].f){
			if(a[b[i].l]){
				for(int j=b[i].l+1;j<=b[i].r;j++){
					if(a[j]){ if(a[j]<a[j-1]){ flag=false;break; } }
					else a[j]=a[j-1]+1;
				}
			}
			else {
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++)a[j]=x++;
			}
		}
		else {
			if(a[b[i].r]&&check(b[i].l,b[i].r)){ flag=false;break; }
			bool ok=false;
			for(int j=b[i].l+1;j<=b[i].r;j++)
				if(a[j]&&a[j]<a[j-1]){ ok=true;break; }
			if(!ok){
				if(!a[b[i].l]){ a[b[i].l]=2001;a[b[i].l+1]=2000;ok=true;break; }
				for(int j=b[i].l+1;j<=b[i].r;j++)
					if(!a[j]){ a[j]=a[j-1]-1;ok=true;break; }
			}
			if(!ok)flag=false;
		}
	}
	if(!flag){ cout<<"NO"<<endl;return 0; }
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++){
		if(i!=1)cout<<" ";
		cout<<(a[i]?a[i]:2000);
	}
	cout<<endl;
	return 0;
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define mid (l+r)/2
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<"---"<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
const int maxn=1e3+10;
int a[maxn];
int n,m;

struct seg{
	int f,l,r;
	bool operator<(const seg &u)const{
		if(l!=u.l)return l<u.l;
		return r<u.r;
	}
}b[maxn];

bool check(int l,int r){
	for(int i=l+1;i<=r;i++)if(a[i]<a[i-1])return false;
	return true;
}

int main(){
	io;
	cin>>n>>m;
	for(int i=1;i<=m;i++)cin>>b[i].f>>b[i].l>>b[i].r;
	sort(b+1,b+1+m);
	bool flag=true;
	for(int i=1;i<=m;i++){
		if(!flag)break;
		if(b[i].f){
			if(a[b[i].l]){
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++){
					if(a[j]){ if(a[j]<x){ flag=false;break; } x=a[j]; }
					else a[j]=x;
				}
			}
			else {
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++)a[j]=x++;
			}
		}
		else {
			if(a[b[i].r]&&check(b[i].l,b[i].r)){ flag=false;break; }
			bool ok=false;
			for(int j=b[i].l+1;j<=b[i].r;j++)
				if(a[j]&&a[j]<a[j-1]){ ok=true;break; }
			if(!ok){
				if(!a[b[i].l]){ a[b[i].l]=2000;a[b[i].l+1]=1999;ok=true;break; }
				for(int j=b[i].l+1;j<=b[i].r;j++)
					if(!a[j]){ a[j]=a[j-1]-1;ok=true;break; }
			}
			if(!ok)flag=false;
		}
	}
	if(!flag){ cout<<"NO"<<endl;return 0; }
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++){
		if(i!=1)cout<<" ";
		cout<<(a[i]?a[i]:2000);
	}
	cout<<endl;
	return 0;
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define mid (l+r)/2
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<"---"<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
const int maxn=1e3+10;
int a[maxn];
int n,m;

struct seg{
	int f,l,r;
	bool operator<(const seg &u)const{
		if(f!=u.f)return f>u.f;
		else {
			if(l!=u.l)return l<u.l;
			return r<u.r;
		}
	}
}b[maxn];

bool check(int l,int r){
	for(int i=l+1;i<=r;i++)if(a[i]<a[i-1])return false;
	return true;
}

int main(){
	io;
	cin>>n>>m;
	for(int i=1;i<=m;i++)cin>>b[i].f>>b[i].l>>b[i].r;
	sort(b+1,b+1+m);
	bool flag=true;
	for(int i=1;i<=m;i++){
		if(!flag)break;
		if(b[i].f){
			if(a[b[i].l]){
				for(int j=b[i].l+1;j<=b[i].r;j++){
					if(a[j]){ if(a[j]<a[j-1]){ flag=false;break; } }
					else a[j]=a[j-1]+1;
				}
			}
			else {
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++)a[j]=x++;
			}
		}
		else {
			bool ok=false;
			for(int j=b[i].l;j<=b[i].r;j++)if(!a[j])ok=true;
			if(!ok&&check(b[i].l,b[i].r)){ flag=false;break; }
			if(!ok)continue;
			ok=false;
			for(int j=b[i].l;j<=b[i].r;j++)if(a[j])ok=true;
			if(!ok){ a[b[i].l]=2001;a[b[i].l+1]=2000; }
			else {
				if(!a[b[i].l])a[b[i].l]=5001;
				for(int j=b[i].l+1;j<=b[i].r;j++)if(!a[j])a[j]=a[j-1]-1;
			}
		}
	}
	if(!flag){ cout<<"NO"<<endl;return 0; }
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++){
		if(i!=1)cout<<" ";
		cout<<(a[i]?a[i]:2000);
	}
	cout<<endl;
	return 0;
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define mid (l+r)/2
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<"---"<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
const int maxn=1e3+10;
int a[maxn];
int n,m;

struct seg{
	int f,l,r;
	bool operator<(const seg &u)const{
		if(f!=u.f)return f>u.f;
		else {
			if(l!=u.l)return l<u.l;
			return r<u.r;
		}
	}
}b[maxn];

bool check(int l,int r){
	for(int i=l+1;i<=r;i++)if(a[i]<a[i-1])return false;
	return true;
}

int main(){
	io;
	cin>>n>>m;
	for(int i=1;i<=m;i++)cin>>b[i].f>>b[i].l>>b[i].r;
	sort(b+1,b+1+m);
	bool flag=true;
	for(int i=1;i<=m;i++){
		if(!flag)break;
		if(b[i].f){
			if(a[b[i].l]){
				for(int j=b[i].l+1;j<=b[i].r;j++){
					if(a[j]){ if(a[j]<a[j-1]){ flag=false;break; } }
					else a[j]=a[j-1]+1;
				}
			}
			else {
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++)a[j]=x++;
			}
		}
		else {
			if(a[b[i].r]&&check(b[i].l,b[i].r)){ flag=false;break; }
			bool ok=false;
			for(int j=b[i].l+1;j<=b[i].r;j++)
				if(a[j]&&a[j]<a[j-1]){ ok=true;break; }
			if(!ok){
				if(!a[b[i].l]){ a[b[i].l]=2001;a[b[i].l+1]=2000;ok=true;break; }
				for(int j=b[i].l+1;j<=b[i].r;j++)
					if(!a[j]){ a[j]=a[j-1]-1;ok=true;break; }
			}
			if(!ok)flag=false;
		}
	}
	if(!flag){ cout<<"NO"<<endl;return 0; }
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++){
		if(i!=1)cout<<" ";
		cout<<(a[i]?a[i]:2000);
	}
	cout<<endl;
	return 0;
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define mid (l+r)/2
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<"---"<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
const int maxn=1e3+10;
int a[maxn];
int n,m;

struct seg{
	int f,l,r;
	bool operator<(const seg &u)const{
		if(f!=u.f)return f>u.f;
		else {
			if(l!=u.l)return l<u.l;
			return r<u.r;
		}
	}
}b[maxn];

bool check(int l,int r){
	for(int i=l+1;i<=r;i++)if(a[i]<a[i-1])return false;
	return true;
}

int main(){
	io;
	cin>>n>>m;
	for(int i=1;i<=m;i++)cin>>b[i].f>>b[i].l>>b[i].r;
	sort(b+1,b+1+m);
	bool flag=true;
	for(int i=1;i<=m;i++){
		if(!flag)break;
		if(b[i].f){
			if(a[b[i].l]){
				for(int j=b[i].l+1;j<=b[i].r;j++){
					if(a[j]){ if(a[j]<a[j-1]){ flag=false;break; } }
					else a[j]=a[j-1]+1;
				}
			}
			else {
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++)a[j]=x++;
			}
		}
		else {
			bool ok=false;
			for(int j=b[i].l;j<=b[i].r;j++)if(!a[j])ok=true;
			if(!ok&&check(b[i].l,b[i].r)){ flag=false;break; }
			if(!ok)continue;
			ok=false;
			for(int j=b[i].l;j<=b[i].r;j++)if(a[j])ok=true;
			if(!ok){ a[b[i].l]=5001;a[b[i].l+1]=5000; }
			else {
				if(!a[b[i].l])a[b[i].l]=5001;
				for(int j=b[i].l+1;j<=b[i].r;j++)if(!a[j])a[j]=a[j-1]-1;
			}
		}
	}
	if(!flag){ cout<<"NO"<<endl;return 0; }
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++){
		if(i!=1)cout<<" ";
		cout<<(a[i]?a[i]:2000);
	}
	cout<<endl;
	return 0;
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define mid (l+r)/2
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<"---"<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
const int maxn=1e3+10;
int a[maxn];
int n,m;

struct seg{
	int f,l,r;
	bool operator<(const seg &u)const{
		return l<u.l;
	}
}b[maxn];

bool check(int l,int r){
	for(int i=l+1;i<=r;i++)if(a[i]<a[i-1])return false;
	return true;
}

int main(){
	io;
	cin>>n>>m;
	for(int i=1;i<=m;i++)cin>>b[i].f>>b[i].l>>b[i].r;
	sort(b+1,b+1+m);
	bool flag=true;
	for(int i=1;i<=m;i++){
		if(!flag)break;
		if(b[i].f){
			if(a[b[i].l]){
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++){
					if(a[j]){ if(a[j]<x){ flag=false;break; } x=a[j]; }
					else a[j]=x;
				}
			}
			else {
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++)a[j]=x++;
			}
		}
		else {
			if(a[b[i].r]&&check(b[i].l,b[i].r)){ flag=false;break; }
			bool ok=false;
			for(int j=b[i].l+1;j<=b[i].r;j++)
				if(a[j]&&a[j]<a[j-1]){ ok=true;break; }
			if(!ok){
				if(!a[b[i].l]){ a[b[i].l]=2000;a[b[i].l+1]=1999;ok=true;break; }
				for(int j=b[i].l+1;j<=b[i].r;j++)
					if(!a[j]){ a[j]=a[j-1]-1;ok=true;break; }
			}
			if(!ok)flag=false;
		}
	}
	if(!flag){ cout<<"NO"<<endl;return 0; }
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++){
		if(i!=1)cout<<" ";
		cout<<(a[i]?a[i]:2000);
	}
	cout<<endl;
	return 0;
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define mid (l+r)/2
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<"---"<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
const int maxn=1e3+10;
int a[maxn];
int n,m;

struct seg{
	int f,l,r;
	bool operator<(const seg &u)const{
		if(f!=u.f)return f>u.f;
		else {
			if(l!=u.l)return l<u.l;
			return r<u.r;
		}
	}
}b[maxn];

bool check(int l,int r){
	for(int i=l+1;i<=r;i++)if(a[i]<a[i-1])return false;
	return true;
}

int main(){
	io;
	cin>>n>>m;
	for(int i=1;i<=m;i++)cin>>b[i].f>>b[i].l>>b[i].r;
	sort(b+1,b+1+m);
	bool flag=true;
	for(int i=1;i<=m;i++){
		if(!flag)break;
		if(b[i].f){
			if(a[b[i].l]){
				for(int j=b[i].l+1;j<=b[i].r;j++){
					if(a[j]){ if(a[j]<a[j-1]){ flag=false;break; } }
					else a[j]=a[j-1]+1;
				}
			}
			else {
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++)a[j]=x++;
			}
		}
		else {
			bool ok=false;
			for(int j=b[i].l;j<=b[i].r;j++)if(!a[j])ok=true;
			if(!ok&&check(b[i].l,b[i].r)){ flag=false;break; }
			if(!ok)break;
			ok=false;
			for(int j=b[i].l;j<=b[i].r;j++)if(a[j])ok=true;
			if(!ok){ a[b[i].l]=2001;a[b[i].l+1]=2000; }
			else {
				if(!a[b[i].l])a[b[i].l]=5001;
				for(int j=b[i].l+1;j<=b[i].r;j++)if(!a[j])a[j]=a[j-1]-1;
			}
		}
	}
	if(!flag){ cout<<"NO"<<endl;return 0; }
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++){
		if(i!=1)cout<<" ";
		cout<<(a[i]?a[i]:2000);
	}
	cout<<endl;
	return 0;
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define mid (l+r)/2
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<"---"<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
const int maxn=1e3+10;
int a[maxn],c[maxn];
vector<pii> b;
int n,m;

int main(){
	io;
	cin>>n>>m;
	while(m--){
		int f,l,r;cin>>f>>l>>r;
		if(f)for(int i=l;i<r;i++)c[i]=1;
		else b.pb(pii(l,r));
	}
	a[1]=maxn;
	for(int i=2;i<=n;i++)a[i]=c[i-1]?a[i-1]:a[i-1]-1;
	for(int i=0;i<sz(b);i++)if(a[b[i].fi]==a[b[i].se]){ cout<<"NO"<<endl;return 0; }
	cout<<"YES"<<endl;
		for(int i=1;i<=n;i++){
		if(i!=1)cout<<" ";
		cout<<(a[i]?a[i]:2000);
	}
	cout<<endl;
	return 0;
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define mid (l+r)/2
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<"---"<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
const int maxn=1e3+10;
int a[maxn];
int n,m;

struct seg{
	int f,l,r;
	bool operator<(const seg &u)const{
		if(l!=u.l)return l<u.l;
		return r<u.r;
	}
}b[maxn];

bool check(int l,int r){
	for(int i=l+1;i<=r;i++)if(a[i]<a[i-1])return false;
	return true;
}

int main(){
	io;
	cin>>n>>m;
	for(int i=1;i<=m;i++)cin>>b[i].f>>b[i].l>>b[i].r;
	sort(b+1,b+1+m);
	bool flag=true;
	for(int i=1;i<=m;i++){
		if(!flag)break;
		if(b[i].f){
			if(a[b[i].l]){
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++){
					if(a[j]){ if(a[j]<x){ flag=false;break; } x=a[j]; }
					else a[j]=x;
				}
			}
			else {
				int x=2000;
				for(int j=b[i].l;j<=b[i].r;j++)a[j]=x++;
			}
		}
		else {
			if(a[b[i].r]&&check(b[i].l,b[i].r)){ flag=false;break; }
			bool ok=false;
			for(int j=b[i].l+1;j<=b[i].r;j++)
				if(a[j]&&a[j]<a[j-1]){ ok=true;break; }
			if(!ok){
				if(!a[b[i].l]){ a[b[i].l]=2001;a[b[i].l+1]=2000;ok=true;break; }
				for(int j=b[i].l+1;j<=b[i].r;j++)
					if(!a[j]){ a[j]=a[j-1]-1;ok=true;break; }
			}
			if(!ok)flag=false;
		}
	}
	if(!flag){ cout<<"NO"<<endl;return 0; }
	cout<<"YES"<<endl;
	for(int i=1;i<=n;i++){
		if(i!=1)cout<<" ";
		cout<<(a[i]?a[i]:2000);
	}
	cout<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int>Ipair;
typedef pair<int,Ipair>IIpair;
const int Base=(int)1e5;
vector<Ipair>srt[2],ck[2];
vector<IIpair>arr;
int n,m;
int a[1005];
vector<int>ans;
bool ForSort(Ipair a,Ipair b)
{
	if (a.fi!=b.fi)
		return a.fi<b.fi;
	else return a.se<b.se;
}
bool ForSort2(IIpair a,IIpair b)
{
	if (a.se.fi!=b.se.fi)
		return a.se.fi<b.se.fi;
	else return a.se.se<b.se.se;
}
void makecrt()
{
	int lf=0,rt=0;
	for (auto u:srt[1])
	{
		if (lf==rt)
		{
			lf=u.fi,rt=u.se;
			continue;
		}
		if (lf<=u.fi&&u.fi<=rt) rt=u.se;
		else
		{
			arr.push_back(IIpair(1,Ipair(lf,rt)));
			ck[1].push_back(Ipair(lf,rt));
			lf=u.fi,rt=u.se;
		}
	}
	arr.push_back(IIpair(1,Ipair(lf,rt)));
	ck[1].push_back(Ipair(lf,rt));
	lf=0,rt=0;
	for (auto u:srt[0])
	{
		if (lf==rt)
		{
			lf=u.fi,rt=u.se;
			continue;
		}
		if (lf<=u.fi&&u.fi<=rt) rt=u.se;
		else
		{
			arr.push_back(IIpair(0,Ipair(lf,rt)));
			ck[0].push_back(Ipair(lf,rt));
			lf=u.fi,rt=u.se;
		}
	}
	arr.push_back(IIpair(0,Ipair(lf,rt)));
	ck[0].push_back(Ipair(lf,rt));

}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m;
	int t,x,y;
	for (int i=1;i<=m;i++)
		cin>>t>>x>>y,srt[t].push_back({x,y});
	for (int i=0;i<=1;i++)	sort(srt[i].begin(),srt[i].end(),ForSort);
	makecrt();
	sort(arr.begin(),arr.end(),ForSort2);
	for (auto u:arr)
	{
		for (int i=u.se.fi+1;i<=u.se.se;i++)
		{
			if (u.fi==1) a[i]=a[i-1]+1;
			if (u.fi==0)
			{
				if (a[i]!=0) continue;
				else a[i]=a[i-1]-1;
			}
		}
	}
	for (int i=1;i<=n;i++)
		ans.push_back(Base+a[i]);
	for (auto u:arr)
	{
		bool OK=false;
		for (int i=u.se.fi+1;i<=u.se.se;i++)
		{
			if (u.fi==1&&a[i]<a[i-1])
			{
				cout<<"NO";
				return 0;
			}
			if (u.fi==0&&a[i]<a[i-1])
			{
				OK=true;
				break;
			}
		}
		if (OK==false&&u.fi==0)
			{
				cout<<"NO";
				return 0;
			}
	}
	cout<<"YES"<<endl;
	for (auto u:ans) cout<<u<<" ";
	return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int>Ipair;
typedef pair<int,Ipair>IIpair;
const int Base=(int)1e5;
vector<Ipair>srt[2],ck[2];
vector<IIpair>arr;
int n,m;
int a[1005];
bool ForSort(Ipair a,Ipair b)
{
	if (a.fi!=b.fi)
		return a.fi<b.fi;
	else return a.se<b.se;
}
bool ForSort2(IIpair a,IIpair b)
{
	if (a.se.fi!=b.se.fi)
		return a.se.fi<b.se.fi;
	else return a.se.se<b.se.se;
}
void makecrt()
{
	int lf=0,rt=0;
	for (auto u:srt[1])
	{
		if (lf==rt)
		{
			lf=u.fi,rt=u.se;
			continue;
		}
		if (lf<=u.fi&&u.fi<=rt) rt=u.se;
		else
		{
			arr.push_back(IIpair(1,Ipair(lf,rt)));
			ck[1].push_back(Ipair(lf,rt));
			lf=u.fi,rt=u.se;
		}
	}
	arr.push_back(IIpair(1,Ipair(lf,rt)));
	ck[1].push_back(Ipair(lf,rt));
	lf=0,rt=0;
	for (auto u:srt[0])
	{
		if (lf==rt)
		{
			lf=u.fi,rt=u.se;
			continue;
		}
		if (lf<=u.fi&&u.fi<=rt) rt=u.se;
		else
		{
			arr.push_back(IIpair(0,Ipair(lf,rt)));
			ck[0].push_back(Ipair(lf,rt));
			lf=u.fi,rt=u.se;
		}
	}
	arr.push_back(IIpair(0,Ipair(lf,rt)));
	ck[0].push_back(Ipair(lf,rt));

}
bool check()
{
	for (auto u:ck[0])
	{
		for (auto v:ck[1])
		{
			if (u.fi<=v.fi&&v.se<=u.se) return false;
			if (v.fi<=u.fi&&u.se<=v.se) return false;
		}
	}
	return true;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m;
	int t,x,y;
	for (int i=1;i<=m;i++)
		cin>>t>>x>>y,srt[t].push_back({x,y});
	for (int i=0;i<=1;i++)	sort(srt[i].begin(),srt[i].end(),ForSort);
	makecrt();
	if (!check())
	{
		cout<<"NO";
		return 0;
	}
	else cout<<"YES"<<endl;
	sort(arr.begin(),arr.end(),ForSort2);
	for (auto u:arr)
	{
		for (int i=u.se.fi+1;i<=u.se.se;i++)
		{
			if (u.fi==1) a[i]=a[i-1]+1;
			if (u.fi==0)
			{
				if (a[i]!=0) continue;
				else a[i]=a[i-1]-1;
			}
		}
	}
	for (int i=1;i<=n;i++)
		cout<<a[i]+Base<<" ";
	return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int>Ipair;
const int Base=(int)1e5;
vector<Ipair>srt[2];
int n,m;
int a[1005];
vector<int>pp,po;
bool ForSort(Ipair a,Ipair b)
{
	if (a.fi!=b.fi)
		return a.fi<b.fi;
	else return a.se<b.se;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m;
	int t,x,y;
	for (int i=1;i<=m;i++)
		cin>>t>>x>>y,srt[t].push_back({x,y});
	for (int i=0;i<=1;i++)	sort(srt[i].begin(),srt[i].end(),ForSort);
	int cp=4005;
	for (int i=1;i>=0;i--)
	{
		for (auto u:srt[i])
		{
			if (i==1)
			{
				cp-=4;
				if(a[u.fi]!=0) cp=a[u.fi];
				for (int j=u.fi;j<=u.se;j++)
					a[j]=cp;
			}
			else
			{
				int pos=0;
				for (int j=u.fi;j<u.se;j++)
				if (a[j]==0||a[j]>a[j+1])
					pos=j;
				if (pos==0&&a[u.se]!=0)
				{
					cout<<"NO";
					return 0;
				}
				else
				{
					if (pos!=0&&a[pos]==0)
						pp.push_back(pos);
					else
					{
						if (pos!=0&&a[pos]!=0) continue;
						if (pos==0&&a[u.se]==0) po.push_back(u.se);
					}

				}
			}
		}
	}
	reverse(po.begin(),po.end());
	reverse(pp.begin(),pp.end());
	if (!po.empty())
	for (auto u:po)
		a[u]=a[u-1]-1;
	if (!pp.empty())
	for (auto u:pp)
	{
		if (a[u]==0) a[u]=a[u+1]+1;
	}
	/*for (int i=0;i<=1;i++)
	{
		for (auto u:srt[i])
		if (i==1)
		{
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				cout<<"NO";
				return 0;
			}
		}
		else
		{
			bool OK=false;
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				OK=true;
				break;
			}
			if (!OK)
			{
				cout<<"NO";
				return 0;
			}
		}
	}*/
	cout<<"YES"<<endl;
	for (int i=1;i<=n;i++)
		cout<<a[i]+Base<<" ";
	return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int>Ipair;
const int Base=(int)1e5;
vector<Ipair>srt[2];
int n,m;
int a[1005];
vector<int>pp,po;
bool ForSort(Ipair a,Ipair b)
{
	if (a.fi!=b.fi)
		return a.fi<b.fi;
	else return a.se<b.se;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m;
	int t,x,y;
	for (int i=1;i<=m;i++)
		cin>>t>>x>>y,srt[t].push_back({x,y});
	for (int i=0;i<=1;i++)	sort(srt[i].begin(),srt[i].end(),ForSort);
	int cp=4005;
	for (int i=1;i>=0;i--)
	{
		for (auto u:srt[i])
		{
			if (i==1)
			{
				cp-=4;
				if(a[u.fi]!=0) cp=a[u.fi];
				for (int j=u.fi;j<=u.se;j++)
					a[j]=cp;
			}
			else
			{
				int pos=0;
				for (int j=u.fi;j<u.se;j++)
				if (a[j]==0||a[j]>a[j+1])
					pos=j;
				if (pos==0&&a[u.se]!=0)
				{
					cout<<"NO";
					return 0;
				}
				else
				{
					if (pos!=0&&a[pos]==0)
						pp.push_back(pos);
					else po.push_back(u.se);
				}
			}
		}
	}
	reverse(po.begin(),po.end());
	reverse(pp.begin(),pp.end());
	for (auto u:po)
		a[u]=a[u-1]-1;
	for (auto u:pp)
	{
		if (a[u]==0) a[u]=a[u+1]+1;
	}
	/*for (int i=0;i<=1;i++)
	{
		for (auto u:srt[i])
		if (i==1)
		{
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				cout<<"NO";
				return 0;
			}
		}
		else
		{
			bool OK=false;
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				OK=true;
				break;
			}
			if (!OK)
			{
				cout<<"NO";
				return 0;
			}
		}
	}*/
	cout<<"YES"<<endl;
	for (int i=1;i<=n;i++)
		cout<<a[i]+Base<<" ";
	return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int>Ipair;
typedef pair<int,Ipair>IIpair;
const int Base=(int)1e5;
vector<Ipair>srt[2],ck[2];
vector<IIpair>arr,nt;
int n,m;
int a[1005];
vector<int>ans;
bool ForSort(Ipair a,Ipair b)
{
	if (a.fi!=b.fi)
		return a.fi<b.fi;
	else return a.se<b.se;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m;
	int t,x,y;
	for (int i=1;i<=m;i++)
		cin>>t>>x>>y,srt[t].push_back({x,y});
	for (int i=0;i<=1;i++)	sort(srt[i].begin(),srt[i].end(),ForSort);
	int cp=1005;
	for (int i=1;i>=0;i--)
	{
		for (auto u:srt[i])
		{
			if (i==1)
			{
				cp--;
				if(a[u.fi]!=0) cp=a[u.fi];
				for (int j=u.fi+1;j<=u.se;j++)
					a[j]=cp;
			}
			else
			{
				int pos=0;
				for (int j=u.fi;j<u.se;j++)
				if (a[j]==0||a[j]>a[j+1])
				{
					pos=j;
					break;
				}
				if (pos==0)
				{
					cout<<"NO";
					return 0;
				}
				else
				{
					if (a[pos]==0) a[pos]=a[pos+1]+1;
				}
			}
		}
	}
	for (int i=0;i<=1;i++)
	{
		for (auto u:srt[i])
		if (i==1)
		{
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				cout<<"NO";
				break;
			}
		}
		else
		{
			bool OK=false;
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				OK=true;
				break;
			}
			if (!OK)
			{
				cout<<"NO";
				return 0;
			}
		}
	}
	cout<<"YES"<<endl;
	for (int i=1;i<=n;i++)
		cout<<a[i]+Base<<" ";
	return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int>Ipair;
typedef pair<int,Ipair>IIpair;
const int Base=(int)1e5;
vector<Ipair>srt[2],ck[2];
vector<IIpair>arr,nt;
int n,m;
int a[1005];
vector<int>ans;
bool ForSort(Ipair a,Ipair b)
{
	if (a.fi!=b.fi)
		return a.fi<b.fi;
	else return a.se<b.se;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m;
	int t,x,y;
	for (int i=1;i<=m;i++)
		cin>>t>>x>>y,srt[t].push_back({x,y});
	for (int i=0;i<=1;i++)	sort(srt[i].begin(),srt[i].end(),ForSort);
	int cp=1005;
	for (int i=1;i>=0;i--)
	{
		for (auto u:srt[i])
		{
			if (i==1)
			{
				cp--;
				if(a[u.fi]!=0) cp=a[u.fi];
				for (int j=u.fi+1;j<=u.se;j++)
					a[j]=cp;
			}
			else
			{
				int pos=0;
				for (int j=u.fi;j<u.se;j++)
				if (a[j]==0||a[j]>a[j+1])
					pos=j;
				if (pos==0)
				{
					cout<<"NO";
					return 0;
				}
				else
				{
					if (a[pos]==0) a[pos]=a[pos+1]+1;
				}
			}
		}
	}
	for (int i=0;i<=1;i++)
	{
		for (auto u:srt[i])
		if (i==1)
		{
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				cout<<"NO";
				return 0;
			}
		}
		else
		{
			bool OK=false;
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				OK=true;
				break;
			}
			if (!OK)
			{
				cout<<"NO";
				return 0;
			}
		}
	}
	cout<<"YES"<<endl;
	for (int i=1;i<=n;i++)
		cout<<a[i]+Base<<" ";
	return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int>Ipair;
typedef pair<int,Ipair>IIpair;
const int Base=(int)1e5;
vector<Ipair>srt[2],ck[2];
vector<IIpair>arr;
int n,m;
int a[1005];
bool ForSort(Ipair a,Ipair b)
{
	if (a.fi!=b.fi)
		return a.fi<b.fi;
	else return a.se<b.se;
}
bool ForSort2(IIpair a,IIpair b)
{
	if (a.se.fi!=b.se.fi)
		return a.se.fi<b.se.fi;
	else return a.se.se<b.se.se;
}
void makecrt()
{
	int lf=0,rt=0;
	for (auto u:srt[1])
	{
		if (lf==rt)
		{
			lf=u.fi,rt=u.se;
			continue;
		}
		if (lf<=u.fi&&u.fi<=rt) rt=u.se;
		else
		{
			arr.push_back(IIpair(1,Ipair(lf,rt)));
			ck[1].push_back(Ipair(lf,rt));
			lf=u.fi,rt=u.se;
		}
	}
	arr.push_back(IIpair(1,Ipair(lf,rt)));
	ck[1].push_back(Ipair(lf,rt));
	lf=0,rt=0;
	for (auto u:srt[0])
	{
		if (lf==rt)
		{
			lf=u.fi,rt=u.se;
			continue;
		}
		if (lf<=u.fi&&u.fi<=rt) rt=u.se;
		else
		{
			arr.push_back(IIpair(0,Ipair(lf,rt)));
			ck[0].push_back(Ipair(lf,rt));
			lf=u.fi,rt=u.se;
		}
	}
	arr.push_back(IIpair(0,Ipair(lf,rt)));
	ck[0].push_back(Ipair(lf,rt));

}
bool check()
{
	for (auto u:ck[0])
	{
		for (auto v:ck[1])
		{
			//if (u.fi<=v.fi&&v.se<=u.se) return false;
			if (v.fi<=u.fi&&u.se<=v.se) return false;
		}
	}
	return true;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m;
	int t,x,y;
	for (int i=1;i<=m;i++)
		cin>>t>>x>>y,srt[t].push_back({x,y});
	for (int i=0;i<=1;i++)	sort(srt[i].begin(),srt[i].end(),ForSort);
	makecrt();
	if (!check())
	{
		cout<<"NO";
		return 0;
	}
	else cout<<"YES"<<endl;
	sort(arr.begin(),arr.end(),ForSort2);
	for (auto u:arr)
	{
		for (int i=u.se.fi+1;i<=u.se.se;i++)
		{
			if (u.fi==1) a[i]=a[i-1]+1;
			if (u.fi==0)
			{
				if (a[i]!=0) continue;
				else a[i]=a[i-1]-1;
			}
		}
	}
	for (int i=1;i<=n;i++)
		cout<<a[i]+Base<<" ";
	return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int>Ipair;
typedef pair<int,Ipair>IIpair;
const int Base=(int)1e5;
vector<Ipair>srt[2],ck[2];
vector<IIpair>arr,nt;
int n,m;
int a[1005];
vector<int>ans;
bool ForSort(Ipair a,Ipair b)
{
	if (a.fi!=b.fi)
		return a.fi<b.fi;
	else return a.se<b.se;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m;
	int t,x,y;
	for (int i=1;i<=m;i++)
		cin>>t>>x>>y,srt[t].push_back({x,y});
	for (int i=0;i<=1;i++)	sort(srt[i].begin(),srt[i].end(),ForSort);
	int cp=1005;
	for (int i=1;i>=0;i--)
	{
		for (auto u:srt[i])
		{
			if (i==1)
			{
				cp--;
				if(a[u.fi]!=0) cp=a[u.fi];
				for (int j=u.fi;j<=u.se;j++)
					a[j]=cp;
			}
			else
			{
				int pos=0;
				for (int j=u.fi;j<u.se;j++)
				if (a[j]==0||a[j]>a[j+1])
					pos=j;
				if (pos==0)
				{
					cout<<"NO";
					return 0;
				}
				else
				{
					if (a[pos]==0)
                                        {
                                          if (a[pos+1]!=0)
  B                                        a[pos]=a[pos+1]+1;
                                          else a[pos]=1005;
                                         }
				}
			}
		}
	}
	for (int i=0;i<=1;i++)
	{
		for (auto u:srt[i])
		if (i==1)
		{
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				cout<<"NO";
				return 0;
			}
		}
		else
		{
			bool OK=false;
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				OK=true;
				break;
			}
			if (!OK)
			{
				cout<<"NO";
				return 0;
			}
		}
	}
	cout<<"YES"<<endl;
	for (int i=1;i<=n;i++)
		cout<<a[i]+Base<<" ";
	return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int>Ipair;
typedef pair<int,Ipair>IIpair;
const int Base=(int)1e5;
vector<Ipair>srt[2],ck[2];
vector<IIpair>arr,nt;
int n,m;
int a[1005];
vector<int>ans;
bool ForSort(Ipair a,Ipair b)
{
	if (a.fi!=b.fi)
		return a.fi<b.fi;
	else return a.se<b.se;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m;
	int t,x,y;
	for (int i=1;i<=m;i++)
		cin>>t>>x>>y,srt[t].push_back({x,y});
	for (int i=0;i<=1;i++)	sort(srt[i].begin(),srt[i].end(),ForSort);
	int cp=1005;
	for (int i=1;i>=0;i--)
	{
		for (auto u:srt[i])
		{
			if (i==1)
			{
				cp--;
				if(a[u.fi]!=0) cp=a[u.fi];
				for (int j=u.fi;j<=u.se;j++)
					a[j]=cp;
			}
			else
			{
				int pos=0;
				for (int j=u.fi;j<u.se;j++)
				if (a[j]==0||a[j]>a[j+1])
					pos=j;
				if (pos==0)
				{
					cout<<"NO";
					return 0;
				}
				else
				{
					if (a[pos]==0)
                                        {
                                          if (a[pos+1]!=0)
                                         a[pos]=a[pos+1]+1;
                                          else a[pos]=1005;
                                         }
				}
			}
		}
	}
	for (int i=0;i<=1;i++)
	{
		for (auto u:srt[i])
		if (i==1)
		{
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				cout<<"NO";
				return 0;
			}
		}
		else
		{
			bool OK=false;
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				OK=true;
				break;
			}
			if (!OK)
			{
				cout<<"NO";
				return 0;
			}
		}
	}
	cout<<"YES"<<endl;
	for (int i=1;i<=n;i++)
		cout<<a[i]+Base<<" ";
	return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int>Ipair;
const int Base=(int)1e5;
vector<Ipair>srt[2];
int n,m;
int a[1005];
vector<int>pp,po;
bool ForSort(Ipair a,Ipair b)
{
	if (a.fi!=b.fi)
		return a.fi<b.fi;
	else return a.se<b.se;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m;
	int t,x,y;
	for (int i=1;i<=m;i++)
		cin>>t>>x>>y,srt[t].push_back({x,y});
	for (int i=0;i<=1;i++)	sort(srt[i].begin(),srt[i].end(),ForSort);
	int cp=4005;
	for (int i=1;i>=0;i--)
	{
		for (auto u:srt[i])
		{
			if (i==1)
			{
				cp-=4;
				if(a[u.fi]!=0) cp=a[u.fi];
				for (int j=u.fi;j<=u.se;j++)
					a[j]=cp;
			}
			else
			{
				int pos=0;
				for (int j=u.fi;j<u.se;j++)
				if (a[j]==0||a[j]>a[j+1])
					pos=j;
				if (pos==0&&a[u.se]!=0)
				{
					cout<<"NO";
					return 0;
				}
				else
				{
					if (pos!=0&&a[pos]==0)
						pp.push_back(pos);
					else
					{
						if (pos!=0&&a[pos]!=0) continue;
						if (pos==0&&a[u.se]==0) po.push_back(u.se);
					}

				}
			}
		}
	}
	reverse(po.begin(),po.end());
	reverse(pp.begin(),pp.end());
	for (auto u:po)
		a[u]=a[u-1]-1;
	for (auto u:pp)
		if (a[u]==0) a[u]=a[u+1]+1;
	cout<<"YES"<<endl;
	for (int i=1;i<=n;i++)
		cout<<a[i]+Base<<" ";
	return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int>Ipair;
typedef pair<int,Ipair>IIpair;
const int Base=(int)1e5;
vector<Ipair>srt[2],ck[2];
vector<IIpair>arr,nt;
int n,m;
int a[1005];
vector<int>ans;
bool ForSort(Ipair a,Ipair b)
{
	if (a.fi!=b.fi)
		return a.fi<b.fi;
	else return a.se<b.se;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m;
	int t,x,y;
	for (int i=1;i<=m;i++)
		cin>>t>>x>>y,srt[t].push_back({x,y});
	for (int i=0;i<=1;i++)	sort(srt[i].begin(),srt[i].end(),ForSort);
	int cp=1005;
	for (int i=1;i>=0;i--)
	{
		for (auto u:srt[i])
		{
			if (i==1)
			{
				cp--;
				if(a[u.fi]!=0) cp=a[u.fi];
				for (int j=u.fi;j<=u.se;j++)
					a[j]=cp;
			}
			else
			{
				int pos=0;
				for (int j=u.fi;j<u.se;j++)
				if (a[j]==0||a[j]>a[j+1])
					pos=j;
				if (pos==0)
				{
					cout<<"NO";
					return 0;
				}
				else
				{
					if (a[pos]==0)
                                        {
                                          if (a[pos+1]!=0)
                                        a[pos]=a[pos+1]+1;
                                          else a[pos]=1006;
                                         }
				}
			}
		}
	}
	/*for (int i=0;i<=1;i++)
	{
		for (auto u:srt[i])
		if (i==1)
		{
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				cout<<"NO";
				return 0;
			}
		}
		else
		{
			bool OK=false;
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				OK=true;
				break;
			}
			if (!OK)
			{
				cout<<"NO";
				return 0;
			}
		}
	}*/
	cout<<"YES"<<endl;
	for (int i=1;i<=n;i++)
		cout<<a[i]+Base<<" ";
	return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int>Ipair;
typedef pair<int,Ipair>IIpair;
const int Base=(int)1e5;
vector<Ipair>srt[2],ck[2];
vector<IIpair>arr,nt;
int n,m;
int a[1005];
vector<int>ans;
bool ForSort(Ipair a,Ipair b)
{
	if (a.fi!=b.fi)
		return a.fi<b.fi;
	else return a.se<b.se;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m;
	int t,x,y;
	for (int i=1;i<=m;i++)
		cin>>t>>x>>y,srt[t].push_back({x,y});
	for (int i=0;i<=1;i++)	sort(srt[i].begin(),srt[i].end(),ForSort);
	int cp=1005;
	for (int i=1;i>=0;i--)
	{
		for (auto u:srt[i])
		{
			if (i==1)
			{
				cp--;
				if(a[u.fi]!=0) cp=a[u.fi];
				for (int j=u.fi;j<=u.se;j++)
					a[j]=cp;
			}
			else
			{
				int pos=0;
				for (int j=u.fi;j<u.se;j++)
				if (a[j]==0||a[j]>a[j+1])
					pos=j;
				if (pos==0)
				{
					cout<<"NO";
					return 0;
				}
				else
				{
					if (a[pos]==0) a[pos]=a[pos+1]+1;
				}
			}
		}
	}
	for (int i=0;i<=1;i++)
	{
		for (auto u:srt[i])
		if (i==1)
		{
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				cout<<"NO";
				return 0;
			}
		}
		else
		{
			bool OK=false;
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				OK=true;
				break;
			}
			if (!OK)
			{
				cout<<"NO";
				return 0;
			}
		}
	}
	cout<<"YES"<<endl;
	for (int i=1;i<=n;i++)
		cout<<a[i]+Base<<" ";
	return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int>Ipair;
typedef pair<int,Ipair>IIpair;
const int Base=(int)1e5;
vector<Ipair>srt[2],ck[2];
vector<IIpair>arr,nt;
int n,m;
int a[1005];
vector<int>ans;
bool ForSort(Ipair a,Ipair b)
{
	if (a.fi!=b.fi)
		return a.fi<b.fi;
	else return a.se<b.se;
}
bool ForSort2(IIpair a,IIpair b)
{
	if (a.se.fi!=b.se.fi)
		return a.se.fi<b.se.fi;
	else return a.se.se<b.se.se;
}
void makecrt()
{
	int lf=0,rt=0;
	for (auto u:srt[1])
	{
		if (lf==rt)
		{
			lf=u.fi,rt=u.se;
			continue;
		}
		if (lf<=u.fi&&u.fi<=rt) rt=u.se;
		else
		{
			arr.push_back(IIpair(1,Ipair(lf,rt)));
			ck[1].push_back(Ipair(lf,rt));
			lf=u.fi,rt=u.se;
		}
	}
	arr.push_back(IIpair(1,Ipair(lf,rt)));
	ck[1].push_back(Ipair(lf,rt));
	lf=0,rt=0;
	for (auto u:srt[0])
	{
		if (lf==rt)
		{
			lf=u.fi,rt=u.se;
			continue;
		}
		if (lf<=u.fi&&u.fi<=rt) rt=u.se;
		else
		{
			arr.push_back(IIpair(0,Ipair(lf,rt)));
			ck[0].push_back(Ipair(lf,rt));
			lf=u.fi,rt=u.se;
		}
	}
	arr.push_back(IIpair(0,Ipair(lf,rt)));
	ck[0].push_back(Ipair(lf,rt));

}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m;
	int t,x,y;
	for (int i=1;i<=m;i++)
		cin>>t>>x>>y,srt[t].push_back({x,y}),nt.push_back(IIpair(t,Ipair(x,y)));
	for (int i=0;i<=1;i++)	sort(srt[i].begin(),srt[i].end(),ForSort);
	makecrt();
	sort(arr.begin(),arr.end(),ForSort2);
	sort(nt.begin(),nt.end(),ForSort2);
	for (auto u:arr)
	{
		for (int i=u.se.fi+1;i<=u.se.se;i++)
		{
			if (u.fi==1) a[i]=a[i-1]+1;
			if (u.fi==0)
			{
				if (a[i]!=0) continue;
				else a[i]=a[i-1]-1;
			}
		}
	}
	for (int i=1;i<=n;i++)
		ans.push_back(Base+a[i]);
	for (auto u:nt)
	{
		bool OK=false;
		for (int i=u.se.fi+1;i<=u.se.se;i++)
		{
			if (u.fi==1&&a[i]<a[i-1])
			{
				cout<<"NO";
				return 0;
			}
			if (u.fi==0&&a[i]<a[i-1])
			{
				OK=true;
				break;
			}
		}
		if (OK==false&&u.fi==0)
			{
				cout<<"NO";
				return 0;
			}
	}
	cout<<"YES"<<endl;
	for (auto u:ans) cout<<u<<" ";
	return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int>Ipair;
const int Base=(int)1e5;
vector<Ipair>srt[2];
int n,m;
int a[1005];
vector<int>pp;
bool ForSort(Ipair a,Ipair b)
{
	if (a.fi!=b.fi)
		return a.fi<b.fi;
	else return a.se<b.se;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m;
	int t,x,y;
	for (int i=1;i<=m;i++)
		cin>>t>>x>>y,srt[t].push_back({x,y});
	for (int i=0;i<=1;i++)	sort(srt[i].begin(),srt[i].end(),ForSort);
	int cp=1005;
	for (int i=1;i>=0;i--)
	{
		for (auto u:srt[i])
		{
			if (i==1)
			{
				cp--;
				if(a[u.fi]!=0) cp=a[u.fi];
				for (int j=u.fi;j<=u.se;j++)
					a[j]=cp;
			}
			else
			{
				int pos=0;
				for (int j=u.fi;j<u.se;j++)
				if (a[j]==0||a[j]>a[j+1])
					pos=j;
				if (pos==0)
				{
					cout<<"NO";
					return 0;
				}
				else
				{
					if (a[pos]==0)
						pp.push_back(pos);
				}
			}
		}
	}
	reverse(pp.begin(),pp.end());
	for (auto u:pp)
		a[u]=a[u+1]+1;
	/*for (int i=0;i<=1;i++)
	{
		for (auto u:srt[i])
		if (i==1)
		{
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				cout<<"NO";
				return 0;
			}
		}
		else
		{
			bool OK=false;
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				OK=true;
				break;
			}
			if (!OK)
			{
				cout<<"NO";
				return 0;
			}
		}
	}*/
	cout<<"YES"<<endl;
	for (int i=1;i<=n;i++)
		cout<<a[i]+Base<<" ";
	return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int>Ipair;
const int Base=(int)1e5;
vector<Ipair>srt[2];
int n,m;
int a[1005];
vector<int>pp,po;
bool ForSort(Ipair a,Ipair b)
{
	if (a.fi!=b.fi)
		return a.fi<b.fi;
	else return a.se<b.se;
}
int main()
{
	freopen("input.inp","r",stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m;
	int t,x,y;
	for (int i=1;i<=m;i++)
		cin>>t>>x>>y,srt[t].push_back({x,y});
	for (int i=0;i<=1;i++)	sort(srt[i].begin(),srt[i].end(),ForSort);
	int cp=4005;
	for (int i=1;i>=0;i--)
	{
		for (auto u:srt[i])
		{
			if (i==1)
			{
				cp-=4;
				if(a[u.fi]!=0) cp=a[u.fi];
				for (int j=u.fi;j<=u.se;j++)
					a[j]=cp;
			}
			else
			{
				int pos=0;
				for (int j=u.fi;j<u.se;j++)
				if (a[j]==0||a[j]>a[j+1])
					pos=j;
				if (pos==0&&a[u.se]!=0)
				{
					cout<<"NO";
					return 0;
				}
				else
				{
					if (pos!=0&&a[pos]==0)
						pp.push_back(pos);
					else
					{
						if (pos!=0&&a[pos]!=0) continue;
						if (pos==0&&a[u.se]==0) po.push_back(u.se);
					}

				}
			}
		}
	}
	reverse(po.begin(),po.end());
	reverse(pp.begin(),pp.end());
	if (!po.empty())
	for (auto u:po)
		a[u]=a[u-1]-1;
	if (!pp.empty())
	for (auto u:pp)
	{
		if (a[u]==0) a[u]=a[u+1]+1;
	}
	/*for (int i=0;i<=1;i++)
	{
		for (auto u:srt[i])
		if (i==1)
		{
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				cout<<"NO";
				return 0;
			}
		}
		else
		{
			bool OK=false;
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				OK=true;
				break;
			}
			if (!OK)
			{
				cout<<"NO";
				return 0;
			}
		}
	}*/
	cout<<"YES"<<endl;
	for (int i=1;i<=n;i++)
		cout<<a[i]+Base<<" ";
	return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int>Ipair;
typedef pair<int,Ipair>IIpair;
const int Base=(int)1e5;
vector<Ipair>srt[2],ck[2];
vector<IIpair>arr,nt;
int n,m;
int a[1005];
vector<int>ans;
bool ForSort(Ipair a,Ipair b)
{
	if (a.fi!=b.fi)
		return a.fi<b.fi;
	else return a.se<b.se;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>m;
	int t,x,y;
	for (int i=1;i<=m;i++)
		cin>>t>>x>>y,srt[t].push_back({x,y});
	for (int i=0;i<=1;i++)	sort(srt[i].begin(),srt[i].end(),ForSort);
	int cp=1005;
	for (int i=1;i>=0;i--)
	{
		for (auto u:srt[i])
		{
			if (i==1)
			{
				cp--;
				if(a[u.fi]!=0) cp=a[u.fi];
				for (int j=u.fi+1;j<=u.se;j++)
					a[j]=cp;
			}
			else
			{
				int pos=0;
				for (int j=u.fi;j<u.se;j++)
				if (a[j]==0||a[j]>a[j+1])
				{
					pos=j;
					break;
				}
				if (pos==0)
				{
					cout<<"NO";
					return 0;
				}
				else
				{
					if (a[pos]==0) a[pos]=a[pos+1]+1;
				}
			}
		}
	}
	for (int i=0;i<=1;i++)
	{
		for (auto u:srt[i])
		if (i==1)
		{
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				cout<<"NO";
				break;
			}
		}
		else
		{
			bool OK=false;
			for (int j=u.fi;j<u.se;j++)
			if (a[j]>a[j+1])
			{
				OK=true;
				break;
			}
			if (!OK)
			{
				cout<<"NO";
				return 0;
			}
		}
	}
	cout<<"YES";
	for (int i=1;i<=n;i++)
		cout<<a[i]+Base<<" ";
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m;cin>>n>>m;
	ll a[n+2];
	vii v[2];
	rep(i,1,m+1)
	{
		ll aa,b,c;cin>>aa>>b>>c;
		/*if(m==906 and i==443)
			test3(aa,b,c);*/
		v[aa].pb({b,c});
	}
	sort(all(v[0]));
	sort(all(v[1]));

	if(v[1].size()==0)
	{
		cout<<"YES"<<endl;
		ll x=1e7;
		rep(i,1,n+1)
			cout<<x--<<" ";nl;
		return 0;
	}
	rep(i,1,n+1)
	a[i]=0;

	pii merged[n+2];
	merged[1]={v[1][0].ff,v[1][0].ss};
	ll ind=1;
	rep(i,1,v[1].size())
	{
		if(merged[ind].ss >= v[1][i].ff){
			merged[ind]={min(merged[ind].ff,v[1][i].ff),max(merged[ind].ss,v[1][i].ss)};
			//test3("yayay",merged[ind].ff,merged[ind].ss);
		}
		else{
			ind++;
			merged[ind]={v[1][i].ff,v[1][i].ss};
		}
	}
	/*rep(i,1,ind+1)
		test2(merged[i].ff,merged[i].ss);*/
	ll curr=1e7;
	rep(i,1,ind+1)
	{
		//test2(merged[i].ff,merged[i].ss);
		rep(j,merged[i].ff,merged[i].ss+1)
			a[j]=curr;
		curr--;
	}
	curr=1;
	/*if(m==906)
	rep(j,101,109)
		cout<<a[j]<<" ";nl;*/
	rep(j,1,n+1)
		if(!a[j])
			a[j]=curr++;
	/*rep(i,1,n+1)
		cout<<a[i]<<" ";nl;*/
	bool flag=0;
	rep(i,0,v[0].size())
	{
		rep(j,v[0][i].ff+1,v[0][i].ss+1)
			if(a[j-1]>a[j])
				flag=1;
		if(flag==0)
		{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	/*if(flag or v[0].size()==0)
	{*/
		cout<<"YES"<<endl;
		rep(i,1,n+1)
			cout<<a[i]<<" ";nl;
	/*}
	else
		cout<<"NO"<<endl;*/

}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define make make_pair
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,m;
	cin>>n>>m;
	ll arr[N];
	rep(i,1,n+1)
	arr[i]=1;
	ll flag=0;
	while(m--)
	{
		ll t,l,r;
		cin>>t>>l>>r;
		if(t==1)
		{
			ll x= arr[l];
			for(ll i=l+1;i<=r;i++)
			arr[i]=arr[i-1]+1;
		}
		else
		{
			if(arr[l]<arr[r])
			flag=1;
			else if( arr[r]< arr[l])
			{}
			else
			{
				arr[l+1]= arr[l]-1;
			}

		}

	}
	ll min=arr[1];
	rep(i,1,n+1)
	{
		if( arr[i]<min)
		min=arr[i];
	}
	ll x=1-min;
	rep(i,1,n+1)
	arr[i]+=x;

	if(flag)
	cout << "NO"<< endl;
	else
	{
		cout <<"YES"<<endl;
		rep(i,1,n+1)
		cout << arr[i]<<" ";nl;
	}

}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m;cin>>n>>m;
	ll a[n+2];
	vii v[2];
	rep(i,1,m+1)
	{
		ll aa,b,c;cin>>aa>>b>>c;
				if(m==906 and i==443)
			test3(a,b,c);
		v[aa].pb({b,c});
	}
	sort(all(v[0]));
	sort(all(v[1]));

	if(v[1].size()==0)
	{
		cout<<"YES"<<endl;
		ll x=1e7;
		rep(i,1,n+1)
			cout<<x--<<" ";nl;
		return 0;
	}
	rep(i,1,n+1)
	a[i]=0;

	pii merged[n+2];
	merged[1]={v[1][0].ff,v[1][0].ss};
	ll ind=1;
	rep(i,1,v[1].size())
	{
		if(merged[ind].ss >= v[1][i].ff){
			merged[ind]={min(merged[ind].ff,v[1][i].ff),max(merged[ind].ss,v[1][i].ss)};
			//test3("yayay",merged[ind].ff,merged[ind].ss);
		}
		else{
			ind++;
			merged[ind]={v[1][i].ff,v[1][i].ss};
		}
	}
	/*rep(i,1,ind+1)
		test2(merged[i].ff,merged[i].ss);*/
	ll curr=1e7;
	rep(i,1,ind+1)
	{
		//test2(merged[i].ff,merged[i].ss);
		rep(j,merged[i].ff,merged[i].ss+1)
			a[j]=curr;
		curr--;
	}
	curr=1;
	rep(j,1,n+1)
		if(!a[j])
			a[j]=curr++;
	/*rep(i,1,n+1)
		cout<<a[i]<<" ";nl;*/
	bool flag=0;
	rep(i,0,v[0].size())
	{
		rep(j,v[0][i].ff+1,v[0][i].ss+1)
			if(a[j-1]>a[j])
				flag=1;
	}
	if(flag or v[0].size()==0)
	{
		cout<<"YES"<<endl;
		rep(i,1,n+1)
			cout<<a[i]<<" ";nl;
	}
	else
		cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m;cin>>n>>m;
	ll a[n+2];
	vii v[2];
	rep(i,1,m+1)
	{
		ll aa,b,c;cin>>aa>>b>>c;
		v[aa].pb({b,c});
	}
	sort(all(v[0]));
	sort(all(v[1]));

	if(v[1].size()==0)
	{
		cout<<"YES"<<endl;
		ll x=1e7;
		rep(i,1,n+1)
			cout<<x--<<" ";nl;
		return 0;
	}
	rep(i,1,n+1)
	a[i]=0;

	pii merged[n+2];
	merged[1]={v[1][0].ff,v[1][0].ss};
	ll ind=1;
	rep(i,1,v[1].size())
	{
		if(merged[ind].ss >= v[1][i].ff){
			merged[ind]={min(merged[ind].ff,v[1][i].ff),max(merged[ind].ss,v[1][i].ss)};
			//test3("yayay",merged[ind].ff,merged[ind].ss);
		}
		else{
			ind++;
			merged[ind]={v[1][i].ff,v[1][i].ss};
		}
	}
	/*rep(i,1,ind+1)
		test2(merged[i].ff,merged[i].ss);*/
	ll curr=1e7;
	rep(i,1,ind+1)
	{
		//test2(merged[i].ff,merged[i].ss);
		rep(j,merged[i].ff,merged[i].ss+1)
			a[j]=curr;
		curr--;
	}
	curr=1;
	rep(j,1,n+1)
		if(!a[j])
			a[j]=curr++;
	/*rep(i,1,n+1)
		cout<<a[i]<<" ";nl;*/
	bool flag=0;
	rep(i,0,v[0].size())
	{
		rep(j,v[0][i].ff+1,v[0][i].ss+1)
			if(a[j-1]>a[j])
				flag=1;
	}
	if(flag)
	{
		cout<<"YES"<<endl;
		rep(i,1,n+1)
			cout<<a[i]<<" ";nl;
	}
	else
		cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m;cin>>n>>m;
	ll a[n+2];
	vii v[2];
	rep(i,1,m+1)
	{
		ll aa,b,c;cin>>aa>>b>>c;
		if(m==906 and i==443)
			test3(aa,b,c);
		v[aa].pb({b,c});
	}
	sort(all(v[0]));
	sort(all(v[1]));

	if(v[1].size()==0)
	{
		cout<<"YES"<<endl;
		ll x=1e7;
		rep(i,1,n+1)
			cout<<x--<<" ";nl;
		return 0;
	}
	rep(i,1,n+1)
	a[i]=0;

	pii merged[n+2];
	merged[1]={v[1][0].ff,v[1][0].ss};
	ll ind=1;
	rep(i,1,v[1].size())
	{
		if(merged[ind].ss >= v[1][i].ff){
			merged[ind]={min(merged[ind].ff,v[1][i].ff),max(merged[ind].ss,v[1][i].ss)};
			//test3("yayay",merged[ind].ff,merged[ind].ss);
		}
		else{
			ind++;
			merged[ind]={v[1][i].ff,v[1][i].ss};
		}
	}
	/*rep(i,1,ind+1)
		test2(merged[i].ff,merged[i].ss);*/
	ll curr=1e7;
	rep(i,1,ind+1)
	{
		//test2(merged[i].ff,merged[i].ss);
		rep(j,merged[i].ff,merged[i].ss+1)
			a[j]=curr;
		curr--;
	}
	curr=1;
	if(m==906)
	rep(j,101,109)
		cout<<a[j]<<" ";nl;
	rep(j,1,n+1)
		if(!a[j])
			a[j]=curr++;
	/*rep(i,1,n+1)
		cout<<a[i]<<" ";nl;*/
	bool flag=0;
	rep(i,0,v[0].size())
	{
		rep(j,v[0][i].ff+1,v[0][i].ss+1)
			if(a[j-1]>a[j])
				flag=1;
	}
	if(flag or v[0].size()==0)
	{
		cout<<"YES"<<endl;
		rep(i,1,n+1)
			cout<<a[i]<<" ";nl;
	}
	else
		cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m;cin>>n>>m;
	ll a[n+2];
	vii v[2];
	rep(i,1,m+1)
	{
		ll aa,b,c;cin>>aa>>b>>c;
		v[aa].pb({b,c});
	}
	sort(all(v[0]));
	sort(all(v[1]));

	if(v[1].size()==0)
	{
		cout<<"YES"<<endl;
		ll x=1e7;
		rep(i,1,n+1)
			cout<<x--<<" ";nl;
		return 0;
	}
	rep(i,1,n+1)
	a[i]=0;

	pii merged[n+2];
	merged[1]={v[1][0].ff,v[1][0].ss};
	ll ind=1;
	rep(i,1,v[1].size())
	{
		if(merged[ind].ss >= v[1][i].ff){
			merged[ind]={min(merged[ind].ff,v[1][i].ff),max(merged[ind].ss,v[1][i].ss)};
			//test3("yayay",merged[ind].ff,merged[ind].ss);
		}
		else{
			ind++;
			merged[ind]={v[1][i].ff,v[1][i].ss};
		}
	}
	/*rep(i,1,ind+1)
		test2(merged[i].ff,merged[i].ss);*/
	ll curr=1e7;
	rep(i,1,ind+1)
	{
		//test2(merged[i].ff,merged[i].ss);
		rep(j,merged[i].ff,merged[i].ss+1)
			a[j]=curr;
		curr--;
	}
	curr=1;
	rep(j,1,n+1)
		if(!a[j])
			a[j]=curr++;
	/*rep(i,1,n+1)
		cout<<a[i]<<" ";nl;*/
	bool flag=0;
	rep(i,0,v[0].size())
	{
		rep(j,v[0][i].ff+1,v[0][i].ss+1)
			if(a[j-1]>a[j])
				flag=1;
	}
	if(flag or v[0].size()==0)
	{
		cout<<"YES"<<endl;
		rep(i,1,n+1)
			cout<<a[i]<<" ";nl;
	}
	else
		cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m;cin>>n>>m;
	ll a[n+2];
	vii v[2];
	rep(i,1,m+1)
	{
		ll aa,b,c;cin>>aa>>b>>c;
		/*if(m==906 and i==443)
			test3(aa,b,c);*/
		v[aa].pb({b,c});
	}
	sort(all(v[0]));
	sort(all(v[1]));

	if(v[1].size()==0)
	{
		cout<<"YES"<<endl;
		ll x=1e7;
		rep(i,1,n+1)
			cout<<x--<<" ";nl;
		return 0;
	}
	rep(i,0,n+2)
	a[i]=0;

	pii merged[n+2];
	merged[1]={v[1][0].ff,v[1][0].ss};
	ll ind=1;
	rep(i,1,v[1].size())
	{
		if(merged[ind].ss >= v[1][i].ff){
			merged[ind]={min(merged[ind].ff,v[1][i].ff),max(merged[ind].ss,v[1][i].ss)};
			//test3("yayay",merged[ind].ff,merged[ind].ss);
		}
		else{
			ind++;
			merged[ind]={v[1][i].ff,v[1][i].ss};
		}
	}
	/*rep(i,1,ind+1)
		test2(merged[i].ff,merged[i].ss);*/
	ll curr=1e7;
	rep(i,1,ind+1)
	{
		//test2(merged[i].ff,merged[i].ss);
		rep(j,merged[i].ff,merged[i].ss+1)
			a[j]=curr;
		curr--;
	}
	curr=1;
	/*if(m==906)
	rep(j,101,109)
		cout<<a[j]<<" ";nl;*/

	/*rep(j,1,n+1)
		if(!a[j])
			a[j]=curr++;*/
	curr=1e9;
	rep(i,0,v[0].size())
	{
		bool flag=1;
		rep(j,v[0][i].ff,v[0][i].ss+1)
		{
			if(a[j]==0 and a[j+1]!=0 and j+1<=v[0][i].ss and j+1<=n)
				a[j]=a[j+1]+1;
			else if(a[j]==0 and a[j-1]!=0 and j-1>=v[0][i].ff and j-1>=1)
				a[j]=a[j-1]-1;
			else
				flag=0;
		}
		if(flag==0)
			rep(j,v[0][i].ff,v[0][i].ss+1)
				a[j]=curr--;
	}
	rep(i,1,n+1)
		if(!a[i])
			a[i]=1e9;
	/*rep(i,1,n+1)
		cout<<a[i]<<" ";nl;*/
	bool flag=0;
	rep(i,0,v[0].size())
	{
		flag=0;
		rep(j,v[0][i].ff+1,v[0][i].ss+1)
			if(a[j-1]>a[j])
				flag=1;
		if(flag==0)
		{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	/*if(flag or v[0].size()==0)
	{*/
		cout<<"YES"<<endl;
		rep(i,1,n+1)
			cout<<a[i]<<" ";nl;
	/*}
	else
		cout<<"NO"<<endl;*/

}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m;cin>>n>>m;
	ll a[n+2];
	vii v[2];
	rep(i,1,m+1)
	{
		ll aa,b,c;cin>>aa>>b>>c;
		/*if(m==906 and i==443)
			test3(aa,b,c);*/
		v[aa].pb({b,c});
	}
	sort(all(v[0]));
	sort(all(v[1]));

	if(v[1].size()==0)
	{
		cout<<"YES"<<endl;
		ll x=1e7;
		rep(i,1,n+1)
			cout<<x--<<" ";nl;
		return 0;
	}
	rep(i,0,n+2)
	a[i]=0;

	pii merged[n+2];
	merged[1]={v[1][0].ff,v[1][0].ss};
	ll ind=1;
	rep(i,1,v[1].size())
	{
		if(merged[ind].ss >= v[1][i].ff){
			merged[ind]={min(merged[ind].ff,v[1][i].ff),max(merged[ind].ss,v[1][i].ss)};
			//test3("yayay",merged[ind].ff,merged[ind].ss);
		}
		else{
			ind++;
			merged[ind]={v[1][i].ff,v[1][i].ss};
		}
	}
	/*rep(i,1,ind+1)
		test2(merged[i].ff,merged[i].ss);*/
	ll curr=1e7;
	rep(i,1,ind+1)
	{
		//test2(merged[i].ff,merged[i].ss);
		rep(j,merged[i].ff,merged[i].ss+1)
			a[j]=curr;
		curr--;
	}
	curr=1;
	/*if(m==906)
	rep(j,101,109)
		cout<<a[j]<<" ";nl;*/

	/*rep(j,1,n+1)
		if(!a[j])
			a[j]=curr++;*/

		/*rep(i,1,n+1)
		cout<<a[i]<<" ";nl;*/

	curr=1e9;
	rep(i,0,v[0].size())
	{
		bool flag=1;
		rep(j,v[0][i].ff,v[0][i].ss+1)
		{
			if(a[j]==0 and a[j+1]!=0 and j+1<=v[0][i].ss and j+1<=n){
				a[j]=a[j+1]+1;break;}
			else if(a[j]==0 and a[j-1]!=0 and j-1>=v[0][i].ff and j-1>=1){
				a[j]=a[j-1]-1;break;}
			else
				flag=0;
		}
		if(flag==0)
			rep(j,v[0][i].ff,v[0][i].ss+1)
				if(!a[j])
					a[j]=curr--;
	}
	rep(i,1,n+1)
		if(!a[i])
			a[i]=1e9;
	/*rep(i,1,n+1)
		cout<<a[i]<<" ";nl;*/
	bool flag=0;
	rep(i,0,v[0].size())
	{
		flag=0;
		rep(j,v[0][i].ff+1,v[0][i].ss+1)
			if(a[j-1]>a[j])
				flag=1;
		if(flag==0)
		{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	/*if(flag or v[0].size()==0)
	{*/
		cout<<"YES"<<endl;
		rep(i,1,n+1)
			cout<<a[i]<<" ";nl;
	/*}
	else
		cout<<"NO"<<endl;*/

}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m;cin>>n>>m;
	ll a[n+2];
	vii v[2];
	rep(i,1,m+1)
	{
		ll aa,b,c;cin>>aa>>b>>c;
		/*if(m==906 and i==443)
			test3(aa,b,c);*/
		v[aa].pb({b,c});
	}
	sort(all(v[0]));
	sort(all(v[1]));

	if(v[1].size()==0)
	{
		cout<<"YES"<<endl;
		ll x=1e7;
		rep(i,1,n+1)
			cout<<x--<<" ";nl;
		return 0;
	}
	rep(i,0,n+2)
	a[i]=0;

	pii merged[n+2];
	merged[1]={v[1][0].ff,v[1][0].ss};
	ll ind=1;
	rep(i,1,v[1].size())
	{
		if(merged[ind].ss >= v[1][i].ff){
			merged[ind]={min(merged[ind].ff,v[1][i].ff),max(merged[ind].ss,v[1][i].ss)};
			//test3("yayay",merged[ind].ff,merged[ind].ss);
		}
		else{
			ind++;
			merged[ind]={v[1][i].ff,v[1][i].ss};
		}
	}
	/*rep(i,1,ind+1)
		test2(merged[i].ff,merged[i].ss);*/
	ll curr=1e7;
	rep(i,1,ind+1)
	{
		//test2(merged[i].ff,merged[i].ss);
		rep(j,merged[i].ff,merged[i].ss+1)
			a[j]=curr;
		curr--;
	}
	curr=1;
	/*if(m==906)
	rep(j,101,109)
		cout<<a[j]<<" ";nl;*/

	/*rep(j,1,n+1)
		if(!a[j])
			a[j]=curr++;*/

		/*rep(i,1,n+1)
		cout<<a[i]<<" ";nl;*/

	curr=1e9;
	rep(i,0,v[0].size())
	{
		bool flag=1;
		rep(j,v[0][i].ff,v[0][i].ss+1)
		{
			if(a[j]==0 and a[j+1]!=0 and j+1<=v[0][i].ss and j+1<=n)
				a[j]=a[j+1]+1;
			else if(a[j]==0 and a[j-1]!=0 and j-1>=v[0][i].ff and j-1>=1)
				a[j]=a[j-1]-1;
			else
				flag=0;
		}
		if(flag==0)
			rep(j,v[0][i].ff,v[0][i].ss+1)
				if(!a[j])
					a[j]=curr--;
	}
	rep(i,1,n+1)
		if(!a[i])
			a[i]=1e9;
	/*rep(i,1,n+1)
		cout<<a[i]<<" ";nl;*/
	bool flag=0;
	rep(i,0,v[0].size())
	{
		flag=0;
		rep(j,v[0][i].ff+1,v[0][i].ss+1)
			if(a[j-1]>a[j])
				flag=1;
		if(flag==0)
		{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	/*if(flag or v[0].size()==0)
	{*/
		cout<<"YES"<<endl;
		rep(i,1,n+1)
			cout<<a[i]<<" ";nl;
	/*}
	else
		cout<<"NO"<<endl;*/

}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m;cin>>n>>m;
	ll a[n+2];
	vii v[2];
	rep(i,1,m+1)
	{
		ll aa,b,c;cin>>aa>>b>>c;
		if(m==906 and i==443)
			test3(aa,b,c);
		v[aa].pb({b,c});
	}
	sort(all(v[0]));
	sort(all(v[1]));

	if(v[1].size()==0)
	{
		cout<<"YES"<<endl;
		ll x=1e7;
		rep(i,1,n+1)
			cout<<x--<<" ";nl;
		return 0;
	}
	rep(i,1,n+1)
	a[i]=0;

	pii merged[n+2];
	merged[1]={v[1][0].ff,v[1][0].ss};
	ll ind=1;
	rep(i,1,v[1].size())
	{
		if(merged[ind].ss >= v[1][i].ff){
			merged[ind]={min(merged[ind].ff,v[1][i].ff),max(merged[ind].ss,v[1][i].ss)};
			//test3("yayay",merged[ind].ff,merged[ind].ss);
		}
		else{
			ind++;
			merged[ind]={v[1][i].ff,v[1][i].ss};
		}
	}
	/*rep(i,1,ind+1)
		test2(merged[i].ff,merged[i].ss);*/
	ll curr=1e7;
	rep(i,1,ind+1)
	{
		//test2(merged[i].ff,merged[i].ss);
		rep(j,merged[i].ff,merged[i].ss+1)
			a[j]=curr;
		curr--;
	}
	curr=1;
	rep(j,1,n+1)
		if(!a[j])
			a[j]=curr++;
	/*rep(i,1,n+1)
		cout<<a[i]<<" ";nl;*/
	bool flag=0;
	rep(i,0,v[0].size())
	{
		rep(j,v[0][i].ff+1,v[0][i].ss+1)
			if(a[j-1]>a[j])
				flag=1;
	}
	if(flag or v[0].size()==0)
	{
		cout<<"YES"<<endl;
		rep(i,1,n+1)
			cout<<a[i]<<" ";nl;
	}
	else
		cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m;cin>>n>>m;
	ll a[n+2];
	vii v[2];
	rep(i,1,m+1)
	{
		ll aa,b,c;cin>>aa>>b>>c;
				if(m==443)
			test3(a,b,c);
		v[aa].pb({b,c});
	}
	sort(all(v[0]));
	sort(all(v[1]));

	if(v[1].size()==0)
	{
		cout<<"YES"<<endl;
		ll x=1e7;
		rep(i,1,n+1)
			cout<<x--<<" ";nl;
		return 0;
	}
	rep(i,1,n+1)
	a[i]=0;

	pii merged[n+2];
	merged[1]={v[1][0].ff,v[1][0].ss};
	ll ind=1;
	rep(i,1,v[1].size())
	{
		if(merged[ind].ss >= v[1][i].ff){
			merged[ind]={min(merged[ind].ff,v[1][i].ff),max(merged[ind].ss,v[1][i].ss)};
			//test3("yayay",merged[ind].ff,merged[ind].ss);
		}
		else{
			ind++;
			merged[ind]={v[1][i].ff,v[1][i].ss};
		}
	}
	/*rep(i,1,ind+1)
		test2(merged[i].ff,merged[i].ss);*/
	ll curr=1e7;
	rep(i,1,ind+1)
	{
		//test2(merged[i].ff,merged[i].ss);
		rep(j,merged[i].ff,merged[i].ss+1)
			a[j]=curr;
		curr--;
	}
	curr=1;
	rep(j,1,n+1)
		if(!a[j])
			a[j]=curr++;
	/*rep(i,1,n+1)
		cout<<a[i]<<" ";nl;*/
	bool flag=0;
	rep(i,0,v[0].size())
	{
		rep(j,v[0][i].ff+1,v[0][i].ss+1)
			if(a[j-1]>a[j])
				flag=1;
	}
	if(flag or v[0].size()==0)
	{
		cout<<"YES"<<endl;
		rep(i,1,n+1)
			cout<<a[i]<<" ";nl;
	}
	else
		cout<<"NO"<<endl;

}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m;cin>>n>>m;
	ll a[n+2];
	vii v[2];
	rep(i,1,m+1)
	{
		ll aa,b,c;cin>>aa>>b>>c;
		/*if(m==906 and i==443)
			test3(aa,b,c);*/
		v[aa].pb({b,c});
	}
	sort(all(v[0]));
	sort(all(v[1]));

	if(v[1].size()==0)
	{
		cout<<"YES"<<endl;
		ll x=1e7;
		rep(i,1,n+1)
			cout<<x--<<" ";nl;
		return 0;
	}
	rep(i,0,n+2)
	a[i]=0;

	pii merged[n+2];
	merged[1]={v[1][0].ff,v[1][0].ss};
	ll ind=1;
	rep(i,1,v[1].size())
	{
		if(merged[ind].ss >= v[1][i].ff){
			merged[ind]={min(merged[ind].ff,v[1][i].ff),max(merged[ind].ss,v[1][i].ss)};
			//test3("yayay",merged[ind].ff,merged[ind].ss);
		}
		else{
			ind++;
			merged[ind]={v[1][i].ff,v[1][i].ss};
		}
	}
	/*rep(i,1,ind+1)
		test2(merged[i].ff,merged[i].ss);*/
	ll curr=1e7;
	rep(i,1,ind+1)
	{
		//test2(merged[i].ff,merged[i].ss);
		rep(j,merged[i].ff,merged[i].ss+1)
			a[j]=curr;
		curr--;
	}
	curr=1;
	/*if(m==906)
	rep(j,101,109)
		cout<<a[j]<<" ";nl;*/

	/*rep(j,1,n+1)
		if(!a[j])
			a[j]=curr++;*/

		/*rep(i,1,n+1)
		cout<<a[i]<<" ";nl;*/

	curr=1e9;
	rep(i,0,v[0].size())
	{
		bool flag=1;
		rep(j,v[0][i].ff,v[0][i].ss+1)
		{

			if(a[j]==0 and a[j+1]!=0 and j+1<=v[0][i].ss and j+1<=n){
				a[j]=a[j+1]+1;flag=1;break;}
			else if(a[j]==0 and a[j-1]!=0 and j-1>=v[0][i].ff and j-1>=1){
				a[j]=a[j-1]-1;flag=1;break;}
			else
				flag=0;
		}
		//test2(i,flag);
		if(flag==0)
			rep(j,v[0][i].ff,v[0][i].ss+1)
				if(!a[j])
					a[j]=curr--;
	}
	rep(i,1,n+1)
		if(!a[i])
			a[i]=1e9;
	/*rep(i,1,n+1)
		cout<<a[i]<<" ";nl;*/
	bool flag=0;
	rep(i,0,v[0].size())
	{
		flag=0;
		rep(j,v[0][i].ff+1,v[0][i].ss+1)
			if(a[j-1]>a[j])
				flag=1;
		if(flag==0)
		{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	/*if(flag or v[0].size()==0)
	{*/
		cout<<"YES"<<endl;
		rep(i,1,n+1)
			cout<<a[i]<<" ";nl;
	/*}
	else
		cout<<"NO"<<endl;*/

}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define nl cout<<endl

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define ff first
#define ss second
#define hell 1000000007

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;
#define N 300009

ll power(ll a,ll b,ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll n,m;cin>>n>>m;
	ll a[n+2];
	vii v[2];
	rep(i,1,m+1)
	{
		ll aa,b,c;cin>>aa>>b>>c;
		/*if(m==906 and i==443)
			test3(aa,b,c);*/
		v[aa].pb({b,c});
	}
	sort(all(v[0]));
	sort(all(v[1]));

	if(v[1].size()==0)
	{
		cout<<"YES"<<endl;
		ll x=1e7;
		rep(i,1,n+1)
			cout<<x--<<" ";nl;
		return 0;
	}
	rep(i,1,n+1)
	a[i]=0;

	pii merged[n+2];
	merged[1]={v[1][0].ff,v[1][0].ss};
	ll ind=1;
	rep(i,1,v[1].size())
	{
		if(merged[ind].ss >= v[1][i].ff){
			merged[ind]={min(merged[ind].ff,v[1][i].ff),max(merged[ind].ss,v[1][i].ss)};
			//test3("yayay",merged[ind].ff,merged[ind].ss);
		}
		else{
			ind++;
			merged[ind]={v[1][i].ff,v[1][i].ss};
		}
	}
	/*rep(i,1,ind+1)
		test2(merged[i].ff,merged[i].ss);*/
	ll curr=1e7;
	rep(i,1,ind+1)
	{
		//test2(merged[i].ff,merged[i].ss);
		rep(j,merged[i].ff,merged[i].ss+1)
			a[j]=curr;
		curr--;
	}
	curr=1;
	/*if(m==906)
	rep(j,101,109)
		cout<<a[j]<<" ";nl;*/

	/*rep(j,1,n+1)
		if(!a[j])
			a[j]=curr++;*/

	rep(i,0,v[0].size())
	{
		rep(j,v[0][i].ff,v[0][i].ss+1)
		{
			if(a[j]==0 and a[j+1]!=0 and j+1<=v[0][i].ss)
				a[j]=a[j+1]+1;
			else if(a[j]==0 and a[j-1]!=0 and j-1>=v[0][i].ff)
				a[j]=a[j-1]-1;
		}
	}
	rep(i,1,n+1)
		if(!a[i])
			a[i]=1e9;
	/*rep(i,1,n+1)
		cout<<a[i]<<" ";nl;*/
	bool flag=0;
	rep(i,0,v[0].size())
	{
		flag=0;
		rep(j,v[0][i].ff+1,v[0][i].ss+1)
			if(a[j-1]>a[j])
				flag=1;
		if(flag==0)
		{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	/*if(flag or v[0].size()==0)
	{*/
		cout<<"YES"<<endl;
		rep(i,1,n+1)
			cout<<a[i]<<" ";nl;
	/*}
	else
		cout<<"NO"<<endl;*/

}