#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
#define f first
#define ss second
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define rep(i,a,b,inc) for(int i=a;i<b;i+=inc)
#define repd(i,a,b,dec) for(int i=a;i>=b;i-=dec)
#define pi 3.14159265359
#define countset(a) __builtin_popcount(a)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
bool comp(pair<int,pii> a,pair<int,pii> b)
{
    return (a.f<b.f);
}
signed main()
{
    fast
    int n,m;
    cin>>n>>m;
    pair<int,pii> take[m];
    int have[n+1];
    bool done[n+1];
    memset(done,false,sizeof(done));
    vector<pii> dec;
    memset(have,0,sizeof(have));
    for (int i=0;i<m;i++)
    {
        cin>>take[i].f>>take[i].ss.f>>take[i].ss.ss;
        if (take[i].f)
        {
            for (int j=take[i].ss.f+1;j<=take[i].ss.ss;j++)
                done[j]=true;
        }
        if (take[i].f==0)
            dec.pb(mp(take[i].ss.f,take[i].ss.ss));
    }
    bool poss=true;
    for (int i=0;i<dec.size();i++)
    {
        pii a=dec[i];
        bool poss1=false;
        for (int j=dec[i].f+1;j<=dec[i].ss;j++)
        {
            if (!done[j])
                poss1=true;
        }
        poss&=poss1;
    }
    if (!poss)
        cout<<"NO";
    else
    {
        int ans[n+1];
        cout<<"YES\n";
        int last=10001;
        ans[1]=10000;
        for (int i=1;i<=n;i++)
        {
            if (done[i])
                ans[i]=i+10000,last=i+10000;
            else
            {
                last--;
                if (!done[i])
                    ans[i]=last-1;
            }
        }
        for (int i=1;i<=n;i++)
            cout<<ans[i]<<" ";
    }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
string str;
vector<ll>v;
ll arr[int(1e6)];
int main(){
	ll T,TT=1;
	//cin>>TT;
	for(T=1;T<=TT;T++){
	    ll n,i,k=0,m=0,j=0,ans=0,maxx=INT_MIN,l,r,dig,x=0,y=0,z=0,p=int(1e9+7);
	    cin>>n>>m;
	    ll a[n]={0};
	    vector<pair<ll,ll>>v;
	    vector<ll>v1;
	    vector<ll>v2;
	    for(i=0;i<m;i++){
	        cin>>x>>l>>r;
	        if(x==1){
	            v.pb(make_pair(r-1,l-1));
	        }
	        if(x==0){
	            v1.pb(l-1);
	            v2.pb(r-1);
	        }
	    }
	    sort(v.begin(),v.end());
	    for(i=0;i<v.size();i++){
	        r=v[i].first;
	        l=v[i].second;
	        for(j=l;j<r;j++){
	            a[j]=1;
	        }
	        a[r]=n;
	    }
	    j=2;
	    for(i=n-1;i>=0;i--){
	        if(a[i]==0){
	            a[i]=j;
	            j++;
	        }
	    }
	    for(i=0;i<v1.size();i++){
	        x=0;
	        for(j=v1[i];j<v2[i];j++){
	            if(a[j+1]<a[j])
	                x=1;
	        }
	        if(x==0){
	            cout<<"NO";
	            return 0;
	        }
	    }
	    cout<<"YES"<<endl;
	    for(i=0;i<n;i++){
	        cout<<a[i]<<" ";
	    }
	}
	return 0;
}


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

#define FasterIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(v) v.begin(), v.end()
const int MOD = 1e9+7;

int main(){
    FasterIO;

    int n, m;

    while(cin>>n>>m){
        int t, l, r;

        int data[n];

        for(int i=0, j=n; i<n; i++, j--)
            data[i] = j;

        vector<pair<int, int> >v[2];

        while(m--){
            cin>>t>>l>>r;
            v[t].push_back({l, r});
        }

        sort(all(v[1]));

        for(int i=0; i<v[1].size(); i++){
            int l = v[1][i].first, r = v[1][i].second;

            for(int i=l; i<r; i++)
                data[i] = data[l-1];
        }

        bool possible = true;

        for(int i=0; i<v[0].size() && possible; i++){
            int l = v[0][i].first, r = v[0][i].second, j;

            for(j=l; j<r; j++){
                if(data[j]<data[j-1]){
                    break;
                }
            }

            if(j==r)
                possible = false;
        }

        if(!possible)
            cout<<"NO\n";
        else{
            cout<<"YES\n";
            for(int i=0; i<n; i++)
                cout<<data[i]<<" ";
            cout<<endl;
        }
    }

    return 0;
}


#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;

int main() {
//    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n, m;
    cin >> n >> m;
    ll a[n + 1];
    bool what[n + 1];
    memset(what, false, sizeof what);

    memset(a, 0, sizeof a);
    vector<pair<ll, ll>> fir, sec;

    for (ll i = 0; i < m; i++) {
        ll type, l, r;
        cin >> type >> l >> r;
        type == 1 ? fir.pb(mp(l, r)) : sec.pb(mp(l, r));

        if (type == 1) {
            for (ll j = l + 1; j <= r; j++) {
                what[j] = true;
            }
        }
    }

    for (auto e : sec) {
        for (auto ee : fir) {
            if (ee.first <= e.first && e.second <= ee.second) {
                cout << "NO";
                return 0;
            }
        }
    }

    sort(fir.begin(), fir.end());
    for (auto e : fir) {
        for (ll i = e.first; i <= e.second; i++) {
            a[i] = (what[i] ? a[i - 1] + 1 : 1);
        }
    }

    ll tar = 1000000;
    for (ll i = 1; i <= n; i++) {
        if (a[i] == 0) {
            a[i] = tar--;
        }
    }

    for (auto e : sec) {
        int c = 0;
        for (int i = e.first + 1; i <= e.second; i++) {
            if (a[i - 1] > a[i]) {
                c++;
                break;
            }
        }

        if (c == 0) {
            cout << "NO";
            return 0;
        }
    }

    cout << "YES\n";
    for (ll i = 1; i <= n; i++) {
        cout << a[i] << ' ';
    }

}


#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1010;

//isLess -1
//unknown 0
//isGreater +1

int n, m;
int toNextState[MAXN], mat[MAXN][MAXN], a[MAXN];
vector<int> adj[MAXN];
vector<pair<int, int> > q[3];

int dfs(int v, int val) {
	if (a[v] != 0)
		return a[v];
	int mx = val;
	for (auto u: adj[v])
		mx = max(mx, dfs(u, val));
	return a[v] = mx;
}

int main() {
	cin >> n >> m;
	while (m--) {
		int t, l, r;
		cin >> t >> l >> r;
		q[t].push_back({l, r});
		if (t == 1) {
			for (int i = l; i < r; i++) {
				toNextState[i] = -1;
			}
		}
		else if (t == 0) {
			bool zeroFound = false;
			for (int i = l; i < r; i++) {
				if (toNextState[i] == 0) {
					zeroFound = true;
				}
			}
			if (!zeroFound) {
				cout << "NO" << endl;
				return 0;
			}
		}
	}
	for (int i = 1; i < n; i++) {
		if (toNextState[i] == 1) {
			adj[i].push_back(i + 1);
		}
		if (toNextState[i] == -1) {
			adj[i + 1].push_back(i);
		}
	}
	int val = 1;
	for (int i = n; i >= 1; i--)
		if (a[i] == 0) {
			val += 1001;
			dfs(i, val);
		}
	for (auto s: q[0]) {
		int l = s.first, r = s.second;
		vector<int> v, vSorted;
		v.clear();
		vSorted.clear();
		for (int i = l; i <= r; i++) {
			v.push_back(a[i]);
			vSorted.push_back(a[i]);
		}
		sort(vSorted.begin(), vSorted.end());
		if (v == vSorted) {
			cout << "NO" << endl;
			return 0;
		}
	}
	for (auto s: q[1]) {
		int l = s.first, r = s.second;
		vector<int> v, vSorted;
		v.clear();
		vSorted.clear();
		for (int i = l; i <= r; i++) {
			v.push_back(a[i]);
			vSorted.push_back(a[i]);
		}
		sort(vSorted.begin(), vSorted.end());
		if (v != vSorted) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	for (int i = 1; i <= n; i++)
		cout << a[i] << " ";
	return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int n, m;
const int maxN = (int)1e3 + 100;
int delta[maxN];
int t[maxN], l[maxN], r[maxN];
bool ok[maxN];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    cin >> n >> m;
    for (int i = 1; i <= m; i++) {
        cin >> t[i] >> l[i] >> r[i];
        if (t[i] == 1) {
            delta[l[i]] += 1;
            delta[r[i]] -= 1;
        }
    }
    for (int i = 1; i < n; i++) {
        delta[i] += delta[i - 1];
        if (delta[i] > 0) ok[i] = true;
        else ok[i] = false;
    }
    for (int i = 1; i <= m; i++) {
        if (t[i] == 0) {
            bool has = false;
            for (int j = l[i]; j < r[i]; j++) {
                if (!ok[j]) {
                    has = true;
                    break;
                }
            }
            if (!has) {
                cout << "NO" << '\n';
                return 0;
            }
        }
    }
    cout << "YES" << '\n';
    int prv = 100000;
    cout << prv << " ";
    for (int j = 2; j <= n; j++) {
        if (ok[j - 1]) prv++;
        else prv--;
        cout << prv << " ";
    }
    return 0;
}


#include<bits/stdc++.h>
// Types
#define ll long long
#define ull unsigned long long
// IO
#define sf scanf
#define pf printf
#define mkp make_pair
#define fi first
#define se second
#define endl "\n"

using namespace std;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll inf = 1e16 + 3;
const int mod = 1e9 + 7;
const int lim = 2e5 + 2;

int n, m, ti, li, ri;

vector<pair<pii, int> > facts;

int answ[lim];

bool nondecre(int a, int b)
{
    for(int i = a + 1; i <= b; i++)
        if(answ[i] < answ[i-1])
            return false;
    return true;
}

bool ok[lim];

void solve()
{
    cin >> n >> m;
    for(int i = 0; i < m; i++)
    {
        cin >> ti >> li >> ri;
        facts.push_back(mkp(mkp(li, ri), ti));
    }

    int bs = 10000000;

    for(int i = 1; i <= n; i++)
        answ[i] = i;

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

    int k = bs - 1;
    for(int i = 0; i < m; i++)
    {
        if(facts[i].second == 0)
        {
            int f = facts[i].first.first;
            int s = facts[i].first.second;

            if(nondecre(f, s))
            {
                int idx = -1;

                for(int j = 0; j < m; j++)
                {
                    if(facts[j].second)
                    {
                        for(int i = facts[j].first.first; i < facts[j].first.second; i++)
                        {
                            ok[i] = true;
                        }
                    }
                }

                for(int j = f; j < s; j++)
                    if(!ok[j])
                    {
                        idx = j;
                        break;
                    }
                for(int j = f; j < s; j++)
                    ok[j] = false;

                if(idx == -1)
                {
                    cout << "NO";
                    return;
                }

                answ[idx] = k--;
            }

        }
    }

    for(int i = 0; i < m; i++)
    {
        if(facts[i].second == 1)
        {
            int f = facts[i].first.first;
            int s = facts[i].first.second;

            if(!nondecre(f, s))
            {
                cout << "NO";
                return;
            }
        }
    }

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

}

void fastIO()
{
	cin.sync_with_stdio(false);
	cin.tie(0);
}

void IO()
{
	if(fopen("d:\\lmo.in","r") != NULL)
	{
		freopen("d:\\lmo.in","r",stdin);
	}
	else if(fopen("/media/Beijing/lmo.in","r") != NULL)
	{
		freopen("/media/Beijing/lmo.in", "r", stdin);
	}
}

int main()
{
	IO();

	fastIO();

	solve();
}


/* In the name of Allah */
#include<bits/stdc++.h>
using namespace std;

vector<pair<int, int>> vec;
const int N = 1e3 + 5;
int n, m, par[N];

int get_par(int u) {
	return ~par[u]? par[u] = get_par(par[u]): u;
}

void merge(int u, int v) {
	u = get_par(u);
	v = get_par(v);
	if (u == v)
		return;
	par[min(u, v)] = max(u, v);
}

int main() {
	memset(par, -1, sizeof par);
	for (cin >> n >> m; m--; ) {
		int t, l, r;
		cin >> t >> l >> r;
		if (t & 1)
			for (l--, r--; l < r; l = par[l])
				merge(l, l + 1);
		else
			vec.push_back({--l, --r});
	}
	for (auto x: vec)
		if (get_par(x.first) == get_par(x.second))
			return cout << "NO", 0;
	cout << "YES\n";
	for (int i = 0, x = n; i < n; i++) {
		cout << x << ' ';
		x -= i == get_par(i);
	}
}


#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(lo i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

lo n,m,b[li],a[li],k,flag,t[li],r[li],l[li],PS[li],vis[li],visit[li],visited[li];
lo cev;
PII p[li];
string s;
vector<lo> v;

int main(void){
	scanf("%lld %lld",&n,&m);
	for(lo i=1;i<=m;i++){
		scanf("%lld %lld %lld",&t[i],&l[i],&r[i]);
		p[i].fi=l[i];
		p[i].se=r[i];
		flag=0;
		if(t[i]==0)continue;
		//~ if(t[i]==0){
			//~ for(int j=l[i];j<r[i];j++){
				//~ if(vis[j]==0){flag=1;break;}
			//~ }
			//~ if(flag==0){printf("NO\n");return 0;}
			//~ continue;
		//~ }
		for(int j=l[i];j<r[i];j++){
			vis[j]=1;
		}
	}
	for(int i=1;i<=m;i++){
		if(t[i]==0){
			flag=0;
			for(int j=l[i];j<r[i];j++){
				if(vis[j]==0){flag=1;break;}
			}
			if(flag==0){printf("NO\n");return 0;}
			continue;
		}
	}
	//~ for(lo i=1;i<=m;i++){
		//~ if(t[i]==1)continue;
		//~ for(lo j=1;j<=m;j++){
			//~ if(t[j]==0)continue;
			//~ if(l[i]>=l[j] && r[i]<=r[j]){printf("NO\n");return 0;}
		//~ }
	//~ }
	printf("YES\n");
	//~ FOR{
		//~ PS[i]=PS[i-1]+PS[i];
	//~ }
	FOR{
		a[i]=1002;
	}
	FOR{
		if(i>1){
			if(vis[i-1]==0)a[i]=a[i-1]-1;
			if(vis[i-1]==1)a[i]=a[i-1]+1002;
		}
		printf("%lld ",a[i]);
	}
	return 0;
}


#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
const int MAXN = 2e5 + 54;
int ans[MAXN];
struct S
{
	int t, l, r;
	bool operator < (const S &r)const
	{
		return t>r.t;
	}
}ss[MAXN];
int zzz[MAXN];
int i,j;
int main()
{
	int n, m;

	scanf("%d%d", &n, &m);
	for(i=1;i<=m;i++)
	{
		scanf("%d%d%d",&ss[i].t,&ss[i].l,&ss[i].r);
	}
	int i = 1;
	sort(ss + 1, ss + 1 + m);
	for (; i <= m; i++)
	{
		if (ss[i].t)
		{
			for(j=ss[i].l;j<ss[i].r;j++)
			{
				zzz[j]=1;
			}
		}
		else
		{
			int fg = 0;
			for(j=ss[i].l;j<ss[i].r;j++)
			{
				if (zzz[j] == 0)fg = 1;
			}
			if (fg == 0)
			{
				printf("NO\n");
				return 0;
			}
		}
	}
	printf("YES\n");
	printf("2000 ");
	int la = 2000;
	for(i=1;i<n;i++)
	{

		if(zzz[i]==0)
		{
			la -= 1;
		}
		printf("%d ", la);
	}
	putchar(10);
}


#include <bits/stdc++.h>

using namespace std;

#define INF 1000000000
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define EPS 10e-9
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define st first
#define nd second
#define sz(v) int(v.size())
#define all(X) (X).begin(), (X).end()
#define FOR(I, A, B) for(int I = A; I < B; I++)
#define RFOR(I, A, B) for(int I = A; I >= B; I--)

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<iii> viii;
typedef vector<ll> vll;

int main(){
	int n, m;
	cin >> n >> m;
	vii ois;
	vii bis;
	vector<bool> marked(n, false);
	FOR(i, 0, m){
		int t, l, r;
		cin >> t >> l >> r;
		if(t == 1){
			ois.pb(mp(l-1, r-1));
		} else {
			bis.pb(mp(l-1, r-1));
		}
	}

	FOR(i, 0, sz(ois)){
		ii curr = ois[i];
		FOR(j, curr.st+1, curr.nd+1){
			marked[j] = true;
		}
	}

	FOR(i, 0, sz(bis)){
		ii curr = bis[i];
		bool foi = false;
		FOR(j, curr.st+1, curr.nd+1){
			if(!marked[j]){
				foi = true;
				break;
			}
		}
		if(!foi){
			cout << "NO\n";
			return 0;
		}
	}

	int currVal = 50000;
	cout << "YES \n";

	FOR(i, 0, n){
		if(!marked[i]){
			currVal--;
		}
		printf("%d ", currVal);
	}
	printf("\n");

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

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


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;

void test();

vector<pii> a[2];
int req[10000];

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	f(i,0,m){
		int t,l,r;
		cin >> t >> l >> r;
		a[t].pb({l,r});
	}
	sort(all(a[1]));
	int value = 1e8;
	if(a[1].empty()){
		cout << "Yes\n";
		f(i,0,n){
			cout << n-i << " ";
		}cout << "\n";
		return 0;
	}
	f(i,a[1][0].F,a[1][0].S+1){
		req[i] = value;
	}
	int end = a[1][0].S;
	f(i,1,a[1].size()){
		if(a[1][i].F<=end){
			f(j,end+1,a[1][i].S+1){
				req[j] = value;
			}
			end = max(end,a[1][i].S);
		}else{
			value -= 1001;
			f(j,a[1][i].F,a[1][i].S+1){
				req[j] = value;
			}
			end = a[1][i].S;
		}
	}
	if(req[1] == 0){
		value = 1e9;
	}
	f(i,1,n+1){
		if(req[i] == 0){
			req[i] = value;
			value--;
		}else{
			value = req[i]-1;
		}
	}
	bool flag = false;
	f(i,0,a[0].size()){
		if(req[a[0][i].F] == req[a[0][i].S]){
			flag = true;
		}
	}
	if(flag){
		cout << "No\n";
	}else{
		cout << "Yes\n";
		f(i,1,n+1){
			cout << req[i] << " ";
		}cout << "\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;

void test();

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	vector<pair<pii,int> > q(m);
	ll req[n+1];
	f(i,0,n+1) req[i] = -1;
	int c = 1;
	f(i,0,m){
		int tt,l,r;
		cin >> tt >> l >> r;
		q[i] = {{l,r},tt};
		// cout << tt << "\n";
		if(tt==1){
			req[l] = c;
			req[r] = ++c;
		}else{
			req[l] = c+1;
			req[r] = --c;
		}
		// cout << req[l] << " " << req[r] << "\n";
		// f(i,1,n+1){
		// 	cout << req[i] << " ";
		// }
		// cout << "\n";
	}
	++c;
	// f(i,1,n+1){
	// 	cout << req[i] << " ";
	// }
	// cout << "\n";
	sort(all(q));
	f(i,0,m){
		int l,r,tt;
		l = q[i].F.F , r = q[i].F.S ,tt = q[i].S;
		// cout << tt << " " << q[i].S<<  "\n";
		if(tt == 1){
			ll num = req[l];
			// cout << l << " " << num << "\n";
			f(i,l+1,r+1){
				if(req[i] == -1){
					req[i] = num;
				}else{
					if(req[i]<num){
						cout << "NO\n";
						return 0;
					}else{
						num = req[i];
					}
				}
			}
		}else{
			// ll num = req[l];
			f(i,l+1,r+1){
				if(req[i] == -1){
					req[i] = c;
				}
			}
		}
	}
	cout << "YES\n";
	f(i,1,n+1){
		cout << req[i] << " ";
	}cout << "\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;

void test();

vector<pii> a[2];
int req[10000] = {0};

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	f(i,0,m){
		int t,l,r;
		cin >> t >> l >> r;
		a[t].pb({l,r});
	}
	sort(all(a[1]));
	int value = 1e8;
	if(a[1].empty()){
		cout << "Yes\n";
		f(i,0,n){
			cout << n-i << " ";
		}cout << "\n";
		return 0;
	}
	f(i,a[1][0].F,a[1][0].S+1){
		req[i] = value;
	}
	int end = a[1][0].S;
	f(i,1,a[1].size()){
		if(a[1][i].F<=end){
			f(j,end+1,a[1][i].S+1){
				req[j] = value;
			}
			end = max(end,a[1][i].S);
		}else{
			value -= 1001;
			f(j,a[1][i].F,a[1][i].S+1){
				req[j] = value;
			}
			end = a[1][i].S;
		}
	}
	if(req[1] == 0){
		value = 1e0;
	}
	f(i,1,n+1){
		if(req[i] == 0){
			req[i] = value;
			value--;
		}else{
			value = req[i]-1;
		}
	}
	bool flag = false;
	f(i,0,a[0].size()){
		if(req[a[0][i].F] == req[a[0][i].S]){
			flag = true;
		}
	}
	if(flag){
		cout << "No\n";
	}else{
		cout << "Yes\n";
		f(i,1,n+1){
			cout << req[i] << " ";
		}cout << "\n";
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;

void test();

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	vector<pair<pii,int> > q(m);
	ll req[n+1];
	f(i,0,n+1) req[i] = -MOD;
	int c = 1;
	f(i,0,m){
		int tt,l,r;
		cin >> tt >> l >> r;
		q[i] = {{l,r},tt};
		// cout << tt << "\n";
		if(tt==1){
			req[l] = c;
			req[r] = ++c;
		}else{
			req[l] = c+1;
			req[r] = --c;
		}
		// cout << req[l] << " " << req[r] << "\n";
		// f(i,1,n+1){
		// 	cout << req[i] << " ";
		// }
		// cout << "\n";
	}
	c += N;
	// f(i,1,n+1){
	// 	cout << req[i] << " ";
	// }
	// cout << "\n";
	sort(all(q));
	f(i,0,m){
		int l,r,tt;
		l = q[i].F.F , r = q[i].F.S ,tt = q[i].S;
		// cout << tt << " " << q[i].S<<  "\n";
		if(tt == 1){
			ll num = req[l];
			// cout << l << " " << num << "\n";
			f(i,l+1,r+1){
				if(req[i] == -MOD){
					req[i] = num;
				}else{
					if(req[i]<num){
						cout << "NO\n";
						return 0;
					}else{
						num = req[i];
					}
				}
			}
		}else{
			// ll num = req[l];
			f(i,l+1,r+1){
				if(req[i] == -MOD){
					req[i] = c;
				}
			}
		}
	}
	cout << "YES\n";
	f(i,1,n+1){
		cout << req[i] << " ";
	}cout << "\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;

void test();

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	vector<pair<pii,int> > q(m);
	ll req[n+1];
	f(i,0,n+1) req[i] = -1;
	int c = 1;
	f(i,0,m){
		int tt,l,r;
		cin >> tt >> l >> r;
		q[i] = {{l,r},tt};
		// cout << tt << "\n";
		if(tt==1){
			req[l] = c;
			req[r] = ++c;
		}else{
			req[l] = c;
			req[r] = --c;
		}
		// cout << req[l] << " " << req[r] << "\n";
		// f(i,1,n+1){
		// 	cout << req[i] << " ";
		// }
		// cout << "\n";
	}
	// f(i,1,n+1){
	// 	cout << req[i] << " ";
	// }
	// cout << "\n";
	sort(all(q));
	f(i,0,m){
		int l,r,tt;
		l = q[i].F.F , r = q[i].F.S ,tt = q[i].S;
		// cout << tt << " " << q[i].S<<  "\n";
		if(tt == 1){
			ll num = req[l];
			// cout << l << " " << num << "\n";
			f(i,l+1,r+1){
				if(req[i] == -1){
					req[i] = num;
				}else{
					if(req[i]<num){
						cout << "NO\n";
						return 0;
					}else{
						num = req[i];
					}
				}
			}
		}else{
			ll num = req[l];
			f(i,l+1,r+1){
				if(req[i] == -1){
					req[i] = num;
				}
			}
		}
	}
	cout << "YES\n";
	f(i,1,n+1){
		cout << req[i] << " ";
	}cout << "\n";
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair <int, int>
using namespace std;
const int N = 1e3 + 5;
const int INF = 1e8;

int n, m;
vector <pii> v[2];

int marked[N];
int a[N];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    cin >> n >> m;
    for(int i = 1; i <= m; i++)
    {
        int t, l, r;
        cin >> t >> l >> r;
        v[t].pb({l, r});
    }

    for(auto t: v[1])
        for(int i = t.first + 1; i <= t.second; i++)
            marked[i] = 1;
    for(auto t: v[0])
    {
        int bad = 1;
        for(int i = t.first + 1; i <= t.second; i++)
            bad &= marked[i];
        if(bad)
        {
            cout << "NO" << endl;
            return 0;
        }
    }

    for(int i = 1; i <= n; i++)
        a[i] = i;
    for(auto t: v[0])
    {
        bool cool = false;
        for(int i = t.first + 1; i <= t.second; i++)
            if(a[i] < a[i - 1])
                cool = true;

        if(!cool)
            for(int i = t.first + 1; i <= t.second; i++)
                if(!marked[i])
                {
                    assert(a[i] >= a[i - 1]);
                    swap(a[i], a[i - 1]);
                    break;
                }
    }

    for(int i = 1; i <= n; i++)
        if(marked[i])
            assert(a[i] >= a[i - 1]);

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

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;

void test();

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	vector<bool> done(n,false);
	vector<pii> q1,q2;
	ll req[n+1];
	int val = INT_MAX;
	f(i,0,n+1){
		req[i] = val--;
	}
	f(i,0,m){
		int t,l,r;
		cin >> t >> l >> r;
		if(t==1){
			req[l] = 1;
			req[r] = -1;
			q1.pb({l,r});
		}else{
			q2.pb({l,r});
		}
	}
	ll num = 0;
	int sum = 0;
	f(i,1,n+1){
		if(req[i] == -1 or req[i] == 1){
			num++;
			sum+=req[i];
			if(sum  == 0){
				req[i] = num;
			}
		}
		if(sum == 0){
			num  = 0;
		}else{
			req[i] = num;
		}
	}
	sort(all(q2));
	f(i,0,(int)q2.size()){
		int l = q2[i].F,r = q2[i].S;
		if(is_sorted(req+l,req+l+r)){
			cout << "NO\n";
			return 0;
		}
	}
	cout << "YES\n";
	f(i,1,n+1){
		cout << req[i] << " ";
	}cout << "\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;

void test();

vector<bool> vis(N,false);
vector<pii> a[2];

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	f(i,0,m){
		int t,l,r;
		cin >> t >> l >> r;
		a[t].pb({l,r});
		if(t==1){
			f(i,l+1,r+1){
				vis[i] = true;
			}
		}
	}
	for(auto &i : a[0]){
		int l = i.F, r = i.S;
		int chk = 1;
		f(i,l+1,r+1){
			chk=chk*vis[i];
		}
		if(chk){
			cout << "NO\n";
			return 0;
		}
	}
	int req[n+1];
	f(i,1,n+1){
		req[i] = i;
	}
	for(auto &ii : a[0]){
		bool chk = false;
		f(i,ii.F+1,ii.S+1){
			if(req[i] < req[i-1]){
				chk = true;
			}
		}
		if(!chk){
			f(i,ii.F+1,ii.S+1){
				if(!vis[i]){
					swap(req[i],req[i-1]);
				}
			}
		}
	}
	cout << "YES\n";
	f(i,1,n+1){
		cout << req[i] << " ";
	}cout << "\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;

void test();

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	vector<bool> done(n,false);
	vector<pii> q1,q2;
	ll req[n+1];
	int val = 1e9;
	f(i,0,n+1){
		req[i] = val--;
	}
	f(i,0,m){
		int t,l,r;
		cin >> t >> l >> r;
		if(t==1){
			req[l] = 1;
			req[r] = -1;
			q1.pb({l,r});
		}else{
			q2.pb({l,r});
		}
	}
	ll num = 0;
	int sum = 0;
	f(i,1,n+1){
		if(req[i] == -1 or req[i] == 1){
			num++;
			sum+=req[i];
			if(sum  == 0){
				done[i] = true;
				req[i] = num;
			}
		}
		if(sum == 0){
			num  = 0;
		}else{
			done[i] = true;
			req[i] = num;
		}
	}
	sort(all(q2));
	// f(i,1,n+1){
	// 	cout << req[i] << " ";
	// }cout << "\n";
	f(i,0,(int)q2.size()){
		int l = q2[i].F,r = q2[i].S;
		// cout << l << " " << r << "\n";
		int chk = 1;
		f(i,l,r+1){
			if(!done[i]){
				done[i] = true;
				req[i] = req[i-1]-1;
			}
		}
		// cout << chk << " " << req[l] << " " <<  req[r] << "\n";
		if(is_sorted(req+l,req+r+1)){
			cout << "NO\n";
			return 0;
		}
	}
	cout << "YES\n";
	f(i,1,n+1){
		cout << req[i] << " ";
	}cout << "\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;

void test();

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	vector<pair<pii,int> > q(m);
	ll req[n+1];
	f(i,0,n+1) req[i] = -MOD;
	int c = 1;
	f(i,0,m){
		int tt,l,r;
		cin >> tt >> l >> r;
		q[i] = {{l,r},tt};
		// cout << tt << "\n";
		if(tt==1){
			req[l] = c;
			req[r] = ++c;
		}else{
			req[l] = c+1;
			req[r] = --c;
		}
		// cout << req[l] << " " << req[r] << "\n";
		// f(i,1,n+1){
		// 	cout << req[i] << " ";
		// }
		// cout << "\n";
	}
	c += N
	// f(i,1,n+1){
	// 	cout << req[i] << " ";
	// }
	// cout << "\n";
	sort(all(q));
	f(i,0,m){
		int l,r,tt;
		l = q[i].F.F , r = q[i].F.S ,tt = q[i].S;
		// cout << tt << " " << q[i].S<<  "\n";
		if(tt == 1){
			ll num = req[l];
			// cout << l << " " << num << "\n";
			f(i,l+1,r+1){
				if(req[i] == -MOD){
					req[i] = num;
				}else{
					if(req[i]<num){
						cout << "NO\n";
						return 0;
					}else{
						num = req[i];
					}
				}
			}
		}else{
			// ll num = req[l];
			f(i,l+1,r+1){
				if(req[i] == -MOD){
					req[i] = c;
				}
			}
		}
	}
	cout << "YES\n";
	f(i,1,n+1){
		cout << req[i] << " ";
	}cout << "\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;

void test();

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin >> n >> m;
	vector<pair<pii,int> > q(m);
	ll req[n+1];
	f(i,0,n+1) req[i] = -MOD;
	int c = 1;
	f(i,0,m){
		int tt,l,r;
		cin >> tt >> l >> r;
		q[i] = {{l,r},tt};
		// cout << tt << "\n";
		if(tt==1){
			req[l] = c;
			req[r] = ++c;
		}else{
			c+=2;
			req[l] = c;
			req[r] = --c;
		}
		// cout << req[l] << " " << req[r] << "\n";
		// f(i,1,n+1){
		// 	cout << req[i] << " ";
		// }
		// cout << "\n";
	}
	c += N;
	// f(i,1,n+1){
	// 	cout << req[i] << " ";
	// }
	// cout << "\n";
	sort(all(q));
	f(i,0,m){
		int l,r,tt;
		l = q[i].F.F , r = q[i].F.S ,tt = q[i].S;
		// cout << tt << " " << q[i].S<<  "\n";
		if(tt == 1){
			ll num = req[l];
			// cout << l << " " << num << "\n";
			f(i,l+1,r+1){
				if(req[i] == -MOD){
					req[i] = num;
				}else{
					if(req[i]<num){
						cout << "NO\n";
						return 0;
					}else{
						num = req[i];
					}
				}
			}
		}else{
			// ll num = req[l];
			f(i,l+1,r+1){
				if(req[i] == -MOD){
					req[i] = c;
				}
			}
		}
	}
	f(i,1,n+1){
		if(req[i] == -MOD){
			cout << "NO\n";
			return 0;
		}
	}
	cout << "YES\n";
	f(i,1,n+1){
		cout << req[i] << " ";
	}cout << "\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define pb          push_back
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define ld          long double
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pi          3.14159265358979323

bool cmp1(pll a, pll b)
{
       if(a.F == b.F) return a.S < b.S;
       return a.F<b.F;
}

void solve()
{
      ll n,m; cin>>n>>m;
      ll a[n+1];
      vector<pll>inc,dec;
      memset(a,-1,sizeof a);
      bool vis[n+1];
      memset(vis,0,sizeof vis);
      rep(i,0,m)
      {
             ll t,l,r; cin>>t>>l>>r;
             if(t==1) inc.push_back({l,r});
             else if(t==0) dec.push_back({l,r});
      }
      sort(inc.begin(), inc.end(), cmp1);
      sort(dec.begin(), dec.end(), cmp1);
      //for(pll x : inc) cout<<x.F<<" "<<x.S<<"    "; cout<<endl;
      vector<pll>minc, mdec;
      for(pll x:inc)
      {
             if(minc.empty()) minc.push_back(x);
             else
             {
                    pll t=minc.back();
                    //minc.pop_back();
                    if(t.S >= x.F) { minc.pop_back(); t.S = max(t.S, x.S); minc.push_back({t.F, t.S}); }
                    else { minc.push_back(x); }
             }
      }
      for(pll x:dec)
      {
             if(mdec.empty()) mdec.push_back(x);
             else
             {
                    pll t=mdec.back();
                    mdec.pop_back();
                    if(t.S >= x.F) {t.S = max(t.S, x.S); mdec.push_back(t); }
                    else { mdec.push_back(x); }
             }
      }
      //
      ll k=minc.size();
      //cout<<k<<endl;
      ll c=1;
      for(ll i=k-1; i>=0; i--)
      {
             ll f=minc[i].F, s=minc[i].S;
             for(ll j=f; j<=s; j++)
                     a[j]=c;
             c++;
      }
      k=dec.size();
      for(ll i=k-1; i>=0; i--)
      {
             ll f=dec[i].F, s=dec[i].S;
             if(a[f] > a[s]) continue;
             if(a[f] < a[s]) a[f]=a[s]+1;
             else if(a[s] > 0 && a[f] < 0)
             {
                    a[f] = a[s] + 1;
             }
             if(a[f] == a[s])
             {
                    if(a[f]>0) { cout<<"NO\n"; return; }
                    else { a[s]--; }
             }
             else if(a[f]<0 && a[s]<0)
             {
                    a[s]=a[f]-1;
             }
      }
      ll mn=100000;
      for(ll i=1; i<=n; i++) mn=min(mn,a[i]);
      for(ll i=1; i<=n; i++) a[i]+=abs(mn)+1;
      cout<<"YES\n";
      for(ll i=1; i<=n; i++) cout<<a[i]<<" ";
}

int main(){
	int T = 1;
       //pre();
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define pb          push_back
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define ld          long double
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pi          3.14159265358979323

bool cmp1(pll a, pll b)
{
       if(a.F == b.F) return a.S < b.S;
       return a.F<b.F;
}

void solve()
{
      ll n,m; cin>>n>>m;
      ll a[n+1];
      vector<pll>inc,dec;
      memset(a,-1,sizeof a);
      bool vis[n+1];
      memset(vis,0,sizeof vis);
      rep(i,0,m)
      {
             ll t,l,r; cin>>t>>l>>r;
             if(t==1) inc.push_back({l,r});
             else if(t==0) dec.push_back({l,r});
      }
      sort(inc.begin(), inc.end(), cmp1);
      sort(dec.begin(), dec.end(), cmp1);
      //for(pll x : inc) cout<<x.F<<" "<<x.S<<"    "; cout<<endl;
      vector<pll>minc, mdec;
      for(pll x:inc)
      {
             if(minc.empty()) minc.push_back(x);
             else
             {
                    pll t=minc.back();
                    //minc.pop_back();
                    if(t.S >= x.F) { minc.pop_back(); t.S = max(t.S, x.S); minc.push_back({t.F, t.S}); }
                    else { minc.push_back(x); }
             }
      }
      for(pll x:dec)
      {
             if(mdec.empty()) mdec.push_back(x);
             else
             {
                    pll t=mdec.back();
                    mdec.pop_back();
                    if(t.S >= x.F) {t.S = max(t.S, x.S); mdec.push_back(t); }
                    else { mdec.push_back(x); }
             }
      }
      //
      //for(pll x : minc) cout<<x.F<<" "<<x.S<<" "; cout<<endl;
      ll k=minc.size();
      //cout<<k<<endl;
      ll c=1;
      for(ll i=k-1; i>=0; i--)
      {
             ll f=minc[i].F, s=minc[i].S;
             for(ll j=f; j<=s; j++)
                     a[j]=c;
             c++;
      }
      //for(ll i=1; i<=n; i++) cout<<a[i]<<" "; cout<<endl;
      k=dec.size();
      //cout<<k<<endl;
      for(ll i=0; i<k; i++)
      {
             ll f=dec[i].F, s=dec[i].S;
             if(a[f]==a[s])
             {
                    if(a[f]!=-1) { cout<<"NO\n"; return; }
                    else { a[s]--; }
             }
      }
      //for(ll i=1; i<=n; i++) cout<<a[i]<<" "; cout<<endl;
      ll mn=100000;
      for(ll i=1; i<=n; i++) mn=min(mn,a[i]);
      for(ll i=1; i<=n; i++) a[i]+=abs(mn)+1;
      cout<<"YES\n";
      for(ll i=1; i<=n; i++) cout<<a[i]<<" ";

}

int main() {
	int T = 1;
       //pre();
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define pb          push_back
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define ld          long double
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pi          3.14159265358979323

bool cmp1(pll a, pll b)
{
       if(a.F == b.F) return a.S < b.S;
       return a.F<b.F;
}

void solve()
{
      ll n,m; cin>>n>>m;
      ll a[n+1];
      vector<pll>inc,dec;
      memset(a,-1,sizeof a);
      bool vis[n+1];
      memset(vis,0,sizeof vis);
      rep(i,0,m)
      {
             ll t,l,r; cin>>t>>l>>r;
             if(t==1) inc.push_back({l,r});
             else if(t==0) dec.push_back({l,r});
      }
      sort(inc.begin(), inc.end(), cmp1);
      sort(dec.begin(), dec.end(), cmp1);
      //for(pll x : inc) cout<<x.F<<" "<<x.S<<"    "; cout<<endl;
      vector<pll>minc, mdec;
      for(pll x:inc)
      {
             if(minc.empty()) minc.push_back(x);
             else
             {
                    pll t=minc.back();
                    //minc.pop_back();
                    if(t.S >= x.F) { minc.pop_back(); t.S = max(t.S, x.S); minc.push_back({t.F, t.S}); }
                    else { minc.push_back(x); }
             }
      }
      for(pll x:dec)
      {
             if(mdec.empty()) mdec.push_back(x);
             else
             {
                    pll t=mdec.back();
                    mdec.pop_back();
                    if(t.S >= x.F) {t.S = max(t.S, x.S); mdec.push_back(t); }
                    else { mdec.push_back(x); }
             }
      }
      //
      //for(pll x : minc) cout<<x.F<<" "<<x.S<<" "; cout<<endl;
      ll k=minc.size();
      //cout<<k<<endl;
      ll c=1;
      for(ll i=k-1; i>=0; i--)
      {
             ll f=minc[i].F, s=minc[i].S;
             for(ll j=f; j<=s; j++)
                     a[j]=c;
             c++;
      }
      //for(ll i=1; i<=n; i++) cout<<a[i]<<" "; cout<<endl;
      k=dec.size();
      //cout<<k<<endl;
      for(ll i=0; i<k; i++)
      {
             ll f=dec[i].F, s=dec[i].S;
             if(a[f] > a[s]) continue;
             if(a[f] == a[s])
             {
                    if(a[f]>0) { cout<<"NO\n"; return; }
                    else { a[s]--; }
             }
             else if(a[f]<0 && a[s]<0)
             {
                    a[s]=a[f]-1;
             }
      }
      //for(ll i=1; i<=n; i++) cout<<a[i]<<" "; cout<<endl;
      ll mn=100000;
      for(ll i=1; i<=n; i++) mn=min(mn,a[i]);
      for(ll i=1; i<=n; i++) a[i]+=abs(mn)+1;
      cout<<"YES\n";
      for(ll i=1; i<=n; i++) cout<<a[i]<<" ";}

int main(){
	int T = 1;
       //pre();
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define pb          push_back
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define ld          long double
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pi          3.14159265358979323

bool cmp1(pll a, pll b)
{
       if(a.F == b.F) return a.S < b.S;
       return a.F<b.F;
}

void solve()
{
      ll n,m; cin>>n>>m;
      ll a[n+1];
      vector<pll>inc,dec;
      memset(a,-1,sizeof a);
      bool vis[n+1];
      memset(vis,0,sizeof vis);
      rep(i,0,m)
      {
             ll t,l,r; cin>>t>>l>>r;
             if(t==1) inc.push_back({l,r});
             else if(t==0) dec.push_back({l,r});
      }
      sort(inc.begin(), inc.end(), cmp1);
      sort(dec.begin(), dec.end(), cmp1);
      //for(pll x : inc) cout<<x.F<<" "<<x.S<<"    "; cout<<endl;
      vector<pll>minc, mdec;
      for(pll x:inc)
      {
             if(minc.empty()) minc.push_back(x);
             else
             {
                    pll t=minc.back();
                    //minc.pop_back();
                    if(t.S >= x.F) { minc.pop_back(); t.S = max(t.S, x.S); minc.push_back({t.F, t.S}); }
                    else { minc.push_back(x); }
             }
      }
      for(pll x:dec)
      {
             if(mdec.empty()) mdec.push_back(x);
             else
             {
                    pll t=mdec.back();
                    mdec.pop_back();
                    if(t.S >= x.F) {t.S = max(t.S, x.S); mdec.push_back(t); }
                    else { mdec.push_back(x); }
             }
      }
      //
      //for(pll x : minc) cout<<x.F<<" "<<x.S<<" "; cout<<endl;
      ll k=minc.size();
      //cout<<k<<endl;
      ll c=1;
      for(ll i=k-1; i>=0; i--)
      {
             ll f=minc[i].F, s=minc[i].S;
             for(ll j=f; j<=s; j++)
                     a[j]=c;
             c++;
      }
      //for(ll i=1; i<=n; i++) cout<<a[i]<<" "; cout<<endl;
      k=dec.size();
      //cout<<k<<endl;
      for(ll i=0; i<k; i++)
      {
             ll f=dec[i].F, s=dec[i].S;
             if(a[f]==a[s])
             {
                    if(a[f]!=-1) { cout<<"NO\n"; return; }
                    else { a[s]--; }
             }
             else if(a[f]<0 && a[s]<0)
             {
                    a[s]=a[f]-1;
             }
      }
      //for(ll i=1; i<=n; i++) cout<<a[i]<<" "; cout<<endl;
      ll mn=100000;
      for(ll i=1; i<=n; i++) mn=min(mn,a[i]);
      for(ll i=1; i<=n; i++) a[i]+=abs(mn)+1;
      cout<<"YES\n";
      for(ll i=1; i<=n; i++) cout<<a[i]<<" ";}

int main(){
	int T = 1;
       //pre();
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define pb          push_back
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define ld          long double
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pi          3.14159265358979323

bool cmp1(pll a, pll b)
{
       if(a.F == b.F) return a.S < b.S;
       return a.F<b.F;
}

void solve()
{
      ll n,m; cin>>n>>m;
      ll a[n+1];
      vector<pll>inc,dec;
      memset(a,-1,sizeof a);
      bool vis[n+1];
      memset(vis,0,sizeof vis);
      rep(i,0,m)
      {
             ll t,l,r; cin>>t>>l>>r;
             if(t==1) inc.push_back({l,r});
             else if(t==0) dec.push_back({l,r});
      }
      sort(inc.begin(), inc.end(), cmp1);
      sort(dec.begin(), dec.end(), cmp1);
      //for(pll x : inc) cout<<x.F<<" "<<x.S<<"    "; cout<<endl;
      vector<pll>minc, mdec;
      for(pll x:inc)
      {
             if(minc.empty()) minc.push_back(x);
             else
             {
                    pll t=minc.back();
                    //minc.pop_back();
                    if(t.S >= x.F) { minc.pop_back(); t.S = max(t.S, x.S); minc.push_back({t.F, t.S}); }
                    else { minc.push_back(x); }
             }
      }
      for(pll x:dec)
      {
             if(mdec.empty()) mdec.push_back(x);
             else
             {
                    pll t=mdec.back();
                    mdec.pop_back();
                    if(t.S >= x.F) {t.S = max(t.S, x.S); mdec.push_back(t); }
                    else { mdec.push_back(x); }
             }
      }
      //
      //for(pll x : minc) cout<<x.F<<" "<<x.S<<" "; cout<<endl;
      ll k=minc.size();
      //cout<<k<<endl;
      ll c=1;
      for(ll i=k-1; i>=0; i--)
      {
             ll f=minc[i].F, s=minc[i].S;
             for(ll j=f; j<=s; j++)
                     a[j]=c;
             c++;
      }
      //for(ll i=1; i<=n; i++) cout<<a[i]<<" "; cout<<endl;
      k=dec.size();
      //cout<<k<<endl;
      for(ll i=0; i<k; i++)
      {
             ll f=dec[i].F, s=dec[i].S;
             if(a[f]==a[s])
             {
                    if(a[f]!=-1) { cout<<"NO\n"; return; }
                    else { a[s]--; }
             }
             else if(a[f]<0 && a[s]<0)
             {
                    a[s]=a[f]-1;
             }
      }
      for(ll i=1; i<=n; i++) cout<<a[i]<<" "; cout<<endl;
      ll mn=100000;
      for(ll i=1; i<=n; i++) mn=min(mn,a[i]);
      for(ll i=1; i<=n; i++) a[i]+=abs(mn)+1;
      cout<<"YES\n";
      for(ll i=1; i<=n; i++) cout<<a[i]<<" ";}

int main(){
	int T = 1;
       //pre();
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define pb          push_back
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define ld          long double
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pi          3.14159265358979323

bool cmp1(pll a, pll b)
{
       if(a.F == b.F) return a.S < b.S;
       return a.F<b.F;
}

void solve()
{
      ll n,m; cin>>n>>m;
      ll a[n+1];
      vector<pll>inc,dec;
      memset(a,-1,sizeof a);
      bool vis[n+1];
      memset(vis,0,sizeof vis);
      rep(i,0,m)
      {
             ll t,l,r; cin>>t>>l>>r;
             if(t==1) inc.push_back({l,r});
             else if(t==0) dec.push_back({l,r});
      }
      sort(inc.begin(), inc.end(), cmp1);
      vector<pll>minc;
      for(pll x:inc)
      {
             if(minc.empty()) minc.push_back(x);
             else
             {
                    pll t=minc.back();
                    //minc.pop_back();
                    if(t.S >= x.F) { minc.pop_back(); t.S = max(t.S, x.S); minc.push_back({t.F, t.S}); }
                    else { minc.push_back(x); }
             }
      }
      ll k=minc.size();
      //ll c=1;
      for(ll i=k-1; i>=0; i--)
      {
             ll f=minc[i].F, s=minc[i].S;
             for(ll j=f; j<=s; j++)
                vis[j]=1;
      }
      for(ll i=1; i<=n; i++) if(!vis[i]) { minc.push_back({i,i});}
      sort(minc.begin(), minc.end(),cmp1);
      //for(pll x : minc) cout<<x.F<<" "<<x.S<<endl;
      ll c=1;
      k=minc.size();
      for(ll i=k-1; i>=0; i--)
      {
          ll f=minc[i].F, s=minc[i].S;
          rep(j,f,s+1)
            a[j]=c;
          c++;
      }
      for(ll i=0; i<dec.size(); i++)
      {
          bool ok=0;
          ll f=dec[i].F, s=dec[i].S;
          for(ll j=f; j<s; j++)
            if(a[j]>a[j+1])
                ok=1;
        if(!ok) { cout<<"No\n"; return; }
      }
      cout<<"Yes\n";
      for(ll i=1; i<=n; i++) cout<<a[i]<<" "; cout<<endl;
}

int main(){
	int T = 1;
       //pre();
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define pb          push_back
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define ld          long double
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pi          3.14159265358979323

bool cmp1(pll a, pll b)
{
       if(a.F == b.F) return a.S < b.S;
       return a.F<b.F;
}

void solve()
{
      ll n,m; cin>>n>>m;
      ll a[n+1];
      vector<pll>inc,dec;
      memset(a,-1,sizeof a);
      bool vis[n+1];
      memset(vis,0,sizeof vis);
      rep(i,0,m)
      {
             ll t,l,r; cin>>t>>l>>r;
             if(t==1) inc.push_back({l,r});
             else if(t==0) dec.push_back({l,r});
      }
      sort(inc.begin(), inc.end(), cmp1);
      sort(dec.begin(), dec.end(), cmp1);
      //for(pll x : inc) cout<<x.F<<" "<<x.S<<"    "; cout<<endl;
      vector<pll>minc, mdec;
      for(pll x:inc)
      {
             if(minc.empty()) minc.push_back(x);
             else
             {
                    pll t=minc.back();
                    //minc.pop_back();
                    if(t.S >= x.F) { minc.pop_back(); t.S = max(t.S, x.S); minc.push_back({t.F, t.S}); }
                    else { minc.push_back(x); }
             }
      }
      for(pll x:dec)
      {
             if(mdec.empty()) mdec.push_back(x);
             else
             {
                    pll t=mdec.back();
                    mdec.pop_back();
                    if(t.S >= x.F) {t.S = max(t.S, x.S); mdec.push_back(t); }
                    else { mdec.push_back(x); }
             }
      }
      //
      //for(pll x : minc) cout<<x.F<<" "<<x.S<<" "; cout<<endl;
      ll k=minc.size();
      //cout<<k<<endl;
      ll c=1;
      for(ll i=k-1; i>=0; i--)
      {
             ll f=minc[i].F, s=minc[i].S;
             for(ll j=f; j<=s; j++)
                     a[j]=c;
             c++;
      }
      //for(ll i=1; i<=n; i++) cout<<a[i]<<" "; cout<<endl;
      k=dec.size();
      //cout<<k<<endl;
      for(ll i=0; i<k; i++)
      {
             ll f=dec[i].F, s=dec[i].S;
             if(a[f]==a[s])
             {
                    if(a[f] > 0) { cout<<"NO\n"; return; }
                    else { a[s]--; }
             }
      }
      //for(ll i=1; i<=n; i++) cout<<a[i]<<" "; cout<<endl;

      for(ll i=1; i<=n; i++) a[i]+=100000;
      cout<<"YES\n";
      for(ll i=1; i<=n; i++) cout<<a[i]<<" ";

}

int main() {
	int T = 1;
       //pre();
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define pb          push_back
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define ld          long double
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pi          3.14159265358979323

bool cmp1(pll a, pll b)
{
       if(a.F == b.F) return a.S < b.S;
       return a.F<b.F;
}

void solve()
{
      ll n,m; cin>>n>>m;
      ll a[n+1];
      vector<pll>inc,dec;
      memset(a,-1,sizeof a);
      bool vis[n+1];
      memset(vis,0,sizeof vis);
      rep(i,0,m)
      {
             ll t,l,r; cin>>t>>l>>r;
             if(t==1) inc.push_back({l,r});
             else if(t==0) dec.push_back({l,r});
      }
      sort(inc.begin(), inc.end(), cmp1);
      sort(dec.begin(), dec.end(), cmp1);
      vector<pll>minc, mdec;
      for(pll x:inc)
      {
             if(minc.empty()) minc.push_back(x);
             else
             {
                    pll t=minc.back();
                    //minc.pop_back();
                    if(t.S >= x.F) { minc.pop_back(); t.S = max(t.S, x.S); minc.push_back({t.F, t.S}); }
                    else { minc.push_back(x); }
             }
      }
      for(pll x:dec)
      {
             if(mdec.empty()) mdec.push_back(x);
             else
             {
                    pll t=mdec.back();
                    mdec.pop_back();
                    if(t.S >= x.F) {t.S = max(t.S, x.S); mdec.push_back(t); }
                    else { mdec.push_back(x); }
             }
      }
      //
      ll k=minc.size();
      //cout<<k<<endl;
      ll c=1;
      for(ll i=k-1; i>=0; i--)
      {
             ll f=minc[i].F, s=minc[i].S;
             for(ll j=f; j<=s; j++)
                     a[j]=c;
             c++;
      }
      k=dec.size();
      for(ll i=k-1; i>=0; i--)
      {
             ll f=dec[i].F, s=dec[i].S;
             if(a[f] > a[s]) continue;
             else if(a[s] > 0 && a[f] < 0)
             {
                    a[f] = a[s] + 1;
             }
             if(a[f] == a[s])
             {
                    if(a[f]>0) { cout<<"NO\n"; return; }
                    else { a[s]--; }
             }
             else if(a[f]<0 && a[s]<0)
             {
                    a[s]=a[f]-1;
             }
      }
      ll mn=100000;
      for(ll i=1; i<=n; i++) mn=min(mn,a[i]);
      for(ll i=1; i<=n; i++) a[i]+=abs(mn)+1;
      cout<<"YES\n";
      for(ll i=1; i<=n; i++) cout<<a[i]<<" ";
}

int main(){
	int T = 1;
       //pre();
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define pb          push_back
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define ld          long double
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pi          3.14159265358979323

bool cmp1(pll a, pll b)
{
       if(a.F == b.F) return a.S < b.S;
       return a.F<b.F;
}

void solve()
{
      ll n,m; cin>>n>>m;
      ll a[n+1];
      vector<pll>inc,dec;
      memset(a,-1,sizeof a);
      bool vis[n+1];
      memset(vis,0,sizeof vis);
      rep(i,0,m)
      {
             ll t,l,r; cin>>t>>l>>r;
             if(t==1) inc.push_back({l,r});
             else if(t==0) dec.push_back({l,r});
      }
      sort(inc.begin(), inc.end(), cmp1);
      vector<pll>minc;
      for(pll x:inc)
      {
             if(minc.empty()) minc.push_back(x);
             else
             {
                    pll t=minc.back();
                    //minc.pop_back();
                    if(t.S >= x.F) { minc.pop_back(); t.S = max(t.S, x.S); minc.push_back({t.F, t.S}); }
                    else { minc.push_back(x); }
             }
      }
      ll k=minc.size();
      ll c=1;
      for(ll i=k-1; i>=0; i--)
      {
             ll f=minc[i].F, s=minc[i].S;
             for(ll j=f; j<=s; j++)
                     a[j]=c;
             c++;
      }
      ll st=k+100;
      for(ll i=n; i>=0; i--)
      {
          if(a[i]==-1) a[i]=st++;
      }
      for(ll i=0; i<dec.size(); i++)
      {
          bool ok=0;
          ll f=dec[i].F, s=dec[i].S;
          for(ll j=f; j<s; j++)
            if(a[j]>a[j+1])
                ok=1;
        if(!ok) { cout<<"No\n"; return; }
      }
      cout<<"Yes\n";
      for(ll i=1; i<=n; i++) cout<<a[i]<<" "; cout<<endl;
}

int main(){
	int T = 1;
       //pre();
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define pb          push_back
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define ld          long double
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pi          3.14159265358979323

bool cmp1(pll a, pll b)
{
       if(a.F == b.F) return a.S < b.S;
       return a.F<b.F;
}

void solve()
{
      ll n,m; cin>>n>>m;
      ll a[n+1];
      vector<pll>inc,dec;
      memset(a,-1,sizeof a);
      bool vis[n+1];
      memset(vis,0,sizeof vis);
      rep(i,0,m)
      {
             ll t,l,r; cin>>t>>l>>r;
             if(t==1) inc.push_back({l,r});
             else if(t==0) dec.push_back({l,r});
      }
      sort(inc.begin(), inc.end(), cmp1);
      sort(dec.begin(), dec.end(), cmp1);
      vector<pll>minc, mdec;
      for(pll x:inc)
      {
             if(minc.empty()) minc.push_back(x);
             else
             {
                    pll t=minc.back();
                    minc.pop_back();
                    if(t.S >= x.F) {  t.S = max(t.S, x.S); minc.push_back({t.F, t.S}); }
                    else { minc.push_back(x); }
             }
      }
      for(pll x:dec)
      {
             if(mdec.empty()) mdec.push_back(x);
             else
             {
                    pll t=mdec.back();
                    mdec.pop_back();
                    if(t.S >= x.F) {t.S = max(t.S, x.S); mdec.push_back(t); }
                    else { mdec.push_back(x); }
             }
      }
      //
      //for(pll x : minc) cout<<x.F<<" "<<x.S<<" "; cout<<endl;
      ll k=minc.size();
      ll c=1;
      for(ll i=k-1; i>=0; i--)
      {
             ll f=minc[i].F, s=minc[i].S;
             for(ll j=f; j<=s; j++)
                     a[j]=c;
             c++;
      }
      //for(ll i=1; i<=n; i++) cout<<a[i]<<" "; cout<<endl;
      k=dec.size();
      for(ll i=0; i<k; i++)
      {
             ll f=dec[i].F, s=dec[i].S;
             if(a[f]==a[s])
             {
                    if(a[f]!=-1) { cout<<"NO\n"; return; }
                    else { a[s]--; }
             }
      }
      ll mn=100000;
      for(ll i=1; i<=n; i++) mn=min(mn,a[i]);
      for(ll i=1; i<=n; i++) a[i]+=abs(mn)+1;
      cout<<"YES\n";
      for(ll i=1; i<=n; i++) cout<<a[i]<<" ";

}

int main() {
	int T = 1;
       //pre();
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define pb          push_back
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define ld          long double
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pi          3.14159265358979323

bool cmp1(pll a, pll b)
{
       if(a.F == b.F) return a.S < b.S;
       return a.F<b.F;
}

void solve()
{
      ll n,m; cin>>n>>m;
      ll a[n+1];
      vector<pll>inc,dec;
      memset(a,-1,sizeof a);
      bool vis[n+1];
      memset(vis,0,sizeof vis);
      rep(i,0,m)
      {
             ll t,l,r; cin>>t>>l>>r;
             if(t==1) inc.push_back({l,r});
             else if(t==0) dec.push_back({l,r});
      }
      sort(inc.begin(), inc.end(), cmp1);
      sort(dec.begin(), dec.end(), cmp1);
      //for(pll x : inc) cout<<x.F<<" "<<x.S<<"    "; cout<<endl;
      vector<pll>minc, mdec;
      for(pll x:inc)
      {
             if(minc.empty()) minc.push_back(x);
             else
             {
                    pll t=minc.back();
                    //minc.pop_back();
                    if(t.S >= x.F) { minc.pop_back(); t.S = max(t.S, x.S); minc.push_back({t.F, t.S}); }
                    else { minc.push_back(x); }
             }
      }
      for(pll x:dec)
      {
             if(mdec.empty()) mdec.push_back(x);
             else
             {
                    pll t=mdec.back();
                    mdec.pop_back();
                    if(t.S >= x.F) {t.S = max(t.S, x.S); mdec.push_back(t); }
                    else { mdec.push_back(x); }
             }
      }
      //
      ll k=minc.size();
      //cout<<k<<endl;
      ll c=1;
      for(ll i=k-1; i>=0; i--)
      {
             ll f=minc[i].F, s=minc[i].S;
             for(ll j=f; j<=s; j++)
                     a[j]=c;
             c++;
      }
      k=dec.size();
      for(ll i=0; i<k; i++)
      {
             ll f=dec[i].F, s=dec[i].S;
             if(a[f] > a[s]) continue;
             else if(a[s] > 0 && a[f] < 0)
             {
                    a[f] = a[s] + 1;
             }
             if(a[f] == a[s])
             {
                    if(a[f]>0) { cout<<"NO\n"; return; }
                    else { a[s]--; }
             }
             else if(a[f]<0 && a[s]<0)
             {
                    a[s]=a[f]-1;
             }
      }
      ll mn=100000;
      for(ll i=1; i<=n; i++) mn=min(mn,a[i]);
      for(ll i=1; i<=n; i++) a[i]+=abs(mn)+1;
      cout<<"YES\n";
      for(ll i=1; i<=n; i++) cout<<a[i]<<" ";
}

int main(){
	int T = 1;
       //pre();
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define pb          push_back
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define ld          long double
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pi          3.14159265358979323

bool cmp1(pll a, pll b)
{
       if(a.F == b.F) return a.S < b.S;
       return a.F<b.F;
}

void solve()
{
      ll n,m; cin>>n>>m;
      ll a[n+1];
      vector<pll>inc,dec;
      memset(a,-1,sizeof a);
      rep(i,0,m)
      {
             ll t,l,r; cin>>t>>l>>r;
             if(t==1) inc.push_back({l,r});
             else if(t==0) dec.push_back({l,r});
      }
      sort(inc.begin(), inc.end(), cmp1);
      sort(dec.begin(), dec.end(), cmp1);
      //vector<pll>minc;
      /*for(pll x:inc)
      {
             if(minc.empty()) minc.push_back(x);
             else
             {
                    pll t=minc.back();
                    if(t.S >= x.F) { minc.pop_back(); t.S = max(t.S, x.S); minc.push_back({t.F, t.S}); }
                    else { minc.push_back(x); }
             }
      }*/
      ll k=inc.size();
      ll cc=1;
      for(ll i=k-1; i>=0; i--)
      {
             ll f=inc[i].F, s=inc[i].S;
             for(ll j=f; j<=s; j++)
                     a[j]=cc;
             cc++;
      }
      k=dec.size();
      for(ll i=0; i<k; i++)
      {
             ll f=dec[i].F, s=dec[i].S;
             if(a[f]==a[s])
             {
                    if(a[f]!=-1) { cout<<"NO\n"; return; }
                    else { a[s]--; }
             }
      }
      ll mn=100000;
      for(ll i=1; i<=n; i++) mn=min(mn,a[i]);
      for(ll i=1; i<=n; i++) a[i]+=abs(mn)+1;
      cout<<"YES\n";
      for(ll i=1; i<=n; i++) cout<<a[i]<<" ";

}

int main() {
	int T = 1;
       //pre();
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod         1000000007
#define pb          push_back
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define ld          long double
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pi          3.14159265358979323

bool cmp1(pll a, pll b)
{
       if(a.F == b.F) return a.S < b.S;
       return a.F<b.F;
}

void solve()
{
      ll n,m; cin>>n>>m;
      ll a[n+1];
      vector<pll>inc,dec;
      memset(a,-1,sizeof a);
      rep(i,0,m)
      {
             ll t,l,r; cin>>t>>l>>r;
             if(t==1) inc.push_back({l,r});
             else if(t==0) dec.push_back({l,r});
      }
      sort(inc.begin(), inc.end(), cmp1);
      sort(dec.begin(), dec.end(), cmp1);
      vector<pll>minc;
      for(pll x:inc)
      {
             if(minc.empty()) minc.push_back(x);
             else
             {
                    pll t=minc.back();
                    if(t.S > x.F) { minc.pop_back(); t.S = max(t.S, x.S); minc.push_back({t.F, t.S}); }
                    else { minc.push_back(x); }
             }
      }
      ll k=minc.size();
      ll cc=1;
      for(ll i=k-1; i>=0; i--)
      {
             ll f=minc[i].F, s=minc[i].S;
             for(ll j=f; j<=s; j++)
                     a[j]=cc;
             cc++;
      }
      k=dec.size();
      for(ll i=0; i<k; i++)
      {
             ll f=dec[i].F, s=dec[i].S;
             if(a[f]==a[s])
             {
                    if(a[f]>0) { cout<<"NO\n"; return; }
                    else { a[s]--; }
             }
      }
      ll mn=100000;
      for(ll i=1; i<=n; i++) mn=min(mn,a[i]);
      for(ll i=1; i<=n; i++) a[i]+=abs(mn)+1;
      cout<<"YES\n";
      for(ll i=1; i<=n; i++) cout<<a[i]<<" ";

}

int main() {
	int T = 1;
       //pre();
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


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

#define fastio          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define sze             200005
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define pr(x);          for(auto el : x) cout<<el<<' '; cout<<'\n';
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define mxel            max_element
#define mnel            min_element
#define db(...)         debug(#__VA_ARGS__, __VA_ARGS__)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename Arg1> void debug(const char* name, Arg1&& arg1){cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void debug(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " = " << arg1;
    debug(comma, args...);
}

void c_p_c()
{
    fastio;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("output.txt", "w", stderr);
    #endif
}

int arr[10001]={};

int32_t main()
{
    c_p_c();

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

    mii cnt;
    vector<pii> notsrt;

    while(m--)
    {
        int t,l,r; cin>>t>>l>>r;

        if(!t)
            notsrt.pb(mp(l,r));

        else
        {
            if(cnt.empty())
                cnt[l]=r;

            auto it = cnt.upper_bound(l);

            if(it==cnt.begin())
            {
                cnt[l]=r;
                it = cnt.upper_bound(r);
                it--;
                while(it->ff!=l)
                {
                    int end = it->ss;
                    cnt.erase(it);
                    cnt[l] = max(cnt[l],end);
                    r=cnt[l];

                    it = cnt.upper_bound(r);
                    it--;
                }
            }
            else
            {
                it--;
                int st;
                if(it->ss >= l)
                {
                    it->ss = max(r,it->ss);
                    r = it->ss;
                    st = it->ff;
                }
                else
                {
                    cnt[l]=r;
                    st = l;
                }

                it = cnt.upper_bound(r);
                it--;
                while(it->ff!=st)
                {
                    int end = it->ss;
                    cnt.erase(it);
                    cnt[st] = max(cnt[st],end);
                    r = cnt[st];

                    it = cnt.upper_bound(r);
                    it--;
                }
            }
        }
    }

    int val = 100000000;
    auto it = cnt.begin();

    while(it!=cnt.end())
    {
        //cout<<it->ff<<' '<<it->ss<<'\n';
        auto tmp = it;
        tmp++;

        for(int id=it->ff;id<=it->ss;++id)
            arr[id]=val;

        if(tmp!=cnt.end())
        {
            val -= (tmp->ff-it->ss+1);
        }
        it=tmp;
    }

    for(int i=1;i<=n;++i)
        if(!arr[i])
        {
            if(i==1)
                arr[i]=1000000000;
            else
                arr[i]=arr[i-1]-1;
        }

    for(auto el : notsrt)
    {
        bool found=0;

        for(int i=el.ff;i<el.ss;++i)
        {
            if(arr[i+1]<arr[i])
            {
                found=1;
                break;
            }
        }

        if(!found)
        {
            cout<<"NO\n";
            return 0;
        }
    }

    cout<<"YES\n";

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


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

#define fastio          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define sze             200005
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define pr(x);          for(auto el : x) cout<<el<<' '; cout<<'\n';
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define mxel            max_element
#define mnel            min_element
#define db(...)         debug(#__VA_ARGS__, __VA_ARGS__)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename Arg1> void debug(const char* name, Arg1&& arg1){cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void debug(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " = " << arg1;
    debug(comma, args...);
}

void c_p_c()
{
    fastio;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("output.txt", "w", stderr);
    #endif
}

pair<int,pii> q[1001];
int arr[1001]={};

vector<pii> one_vale;

bool cmp(pii a,pii b)
{
    if(a.ss!=b.ss)
        a.ss > b.ss;

    return a.ff < b.ff;
}

int32_t main()
{
    c_p_c();
    int n,m; cin>>n>>m;

    for(int i=0;i<m;++i)
    {
        cin >> q[i].ff >> q[i].ss.ff >> q[i].ss.ss;

        if(q[i].ff==1)
           one_vale.pb(q[i].ss);
    }

    sort(one_vale.begin(), one_vale.end(),cmp);

    int sz = one_vale.size();

    if(sz)
    {
        int val = 10000005;

        for(int i=0;i<sz;++i)
        {
            for(int j=one_vale[i].ff;j<=one_vale[i].ss;++j)
                arr[j]=val;

            if(i+1<sz && one_vale[i+1].ff > one_vale[i].ss)
                val -= 1005;
        }
    }

    for(int i=1;i<=n;++i)
    {
        if(!arr[i])
        {
            if(i==1)
                arr[i]=100000005;
            else
                arr[i]=arr[i-1]-1;
        }
    }

    for(int i=0;i<m;++i)
    {
        if(q[i].ff==0)
        {
            bool found=0;
            for(int j=q[i].ss.ff;j<q[i].ss.ss;++j)
            {
                if(arr[j+1]<arr[j])
                {
                    found=1;
                    break;
                }
            }
            if(!found)
            {
                cout << "NO\n";
                return 0;
            }
        }
    }

    cout << "YES\n";

    for(int i=1;i<=n;++i)
        cout << arr[i] << ' ';

    return 0;
}


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

#define fastio          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define sze             200005
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define pr(x);          for(auto el : x) cout<<el<<' '; cout<<'\n';
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define mxel            max_element
#define mnel            min_element
#define db(...)         debug(#__VA_ARGS__, __VA_ARGS__)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename Arg1> void debug(const char* name, Arg1&& arg1){cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void debug(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " = " << arg1;
    debug(comma, args...);
}

void c_p_c()
{
    fastio;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("output.txt", "w", stderr);
    #endif
}

int arr[10001]={};

int32_t main()
{
    c_p_c();

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

    mii cnt;
    vector<pii> notsrt;

    while(m--)
    {
        int t,l,r; cin>>t>>l>>r;

        if(!t)
            notsrt.pb(mp(l,r));

        else
        {
            if(cnt.empty())
                cnt[l]=r;

            auto it = cnt.upper_bound(l);

            if(it==cnt.begin())
            {
                cnt[l]=r;
                it = cnt.upper_bound(r);
                it--;
                while(it->ff!=l)
                {
                    int end = it->ss;
                    cnt.erase(end);
                    cnt[l] = max(cnt[l],end);

                    it = cnt.upper_bound(r);
                    it--;
                }
            }
            else
            {
                it--;
                int st;
                if(it->ss >= l)
                {
                    it->ss = max(r,it->ss);
                    r = it->ss;
                    st = it->ff;
                }
                else
                {
                    cnt[l]=r;
                    st = l;
                }

                it = cnt.upper_bound(r);
                it--;
                while(it->ff!=st)
                {
                    int end = it->ss;
                    cnt.erase(end);
                    cnt[st] = max(cnt[st],end);

                    it = cnt.upper_bound(r);
                    it--;
                }
            }
        }
    }

    int val = 1000000000;
    auto it = cnt.begin();

    while(it!=cnt.end())
    {
        //cout<<it->ff<<' '<<it->ss<<'\n';
        auto tmp = it;
        tmp++;

        for(int id=it->ff;id<=it->ss;++id)
            arr[id]=val;

        if(tmp!=cnt.end())
        {
            val -= (tmp->ff-it->ss+1);
        }
        it=tmp;
    }

    for(int i=1;i<=n;++i)
        if(!arr[i])
        {
            if(i==1)
                arr[i]=1000000000;
            else
                arr[i]=arr[i-1]-1;
        }

    for(auto el : notsrt)
    {
        bool found=0;

        for(int i=el.ff;i<el.ss;++i)
        {
            if(arr[i+1]<arr[i])
            {
                found=1;
                break;
            }
        }

        if(!found)
        {
            cout<<"NO\n";
            return 0;
        }
    }

    cout<<"YES\n";

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


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

#define fastio          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define sze             200005
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define pr(x);          for(auto el : x) cout<<el<<' '; cout<<'\n';
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define mxel            max_element
#define mnel            min_element
#define db(...)         debug(#__VA_ARGS__, __VA_ARGS__)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename Arg1> void debug(const char* name, Arg1&& arg1){cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void debug(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " = " << arg1;
    debug(comma, args...);
}

void c_p_c()
{
    fastio;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("output.txt", "w", stderr);
    #endif
}

pair<int,pii> q[1001];
int arr[1001]={};

vector<pii> one_vale;

bool cmp(pii a,pii b)
{
    if(a.ss!=b.ss)
        return a.ss < b.ss;

    return a.ff < b.ff;
}

int32_t main()
{
    c_p_c();
    //cout<<get();
    int n,m; cin>>n>>m;

    for(int i=0;i<m;++i)
    {
        cin >> q[i].ff >> q[i].ss.ff >> q[i].ss.ss;

        if(q[i].ff==1)
           one_vale.pb(q[i].ss);
    }

    sort(one_vale.begin(), one_vale.end(),cmp);

    int sz = one_vale.size();

    if(sz)
    {
        int val = 10000005;

        for(int i=0;i<sz;++i)
        {
            for(int j=one_vale[i].ff;j<=one_vale[i].ss;++j)
                arr[j]=val;

            if(i+1<sz && one_vale[i+1].ff > one_vale[i].ss)
                val -= 1005;
        }
    }

    for(int i=1;i<=n;++i)
    {
        if(!arr[i])
        {
            if(i==1)
                arr[i]=100000005;
            else
                arr[i]=arr[i-1]-1;
        }
    }

    for(int i=0;i<m;++i)
    {
        if(q[i].ff==0)
        {
            bool found=0;
            for(int j=q[i].ss.ff;j<q[i].ss.ss;++j)
            {
                if(arr[j+1]<arr[j])
                {
                    found=1;
                    break;
                }
            }
            if(!found)
            {
                cout << "NO\n";
                return 0;
            }
        }
    }

    cout << "YES\n";

    for(int i=1;i<=n;++i)
        cout << arr[i] << ' ';

    return 0;
}


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

#define fastio          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define sze             200005
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define pr(x);          for(auto el : x) cout<<el<<' '; cout<<'\n';
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define mxel            max_element
#define mnel            min_element
#define db(...)         debug(#__VA_ARGS__, __VA_ARGS__)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename Arg1> void debug(const char* name, Arg1&& arg1){cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void debug(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " = " << arg1;
    debug(comma, args...);
}

void c_p_c()
{
    fastio;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("output.txt", "w", stderr);
    #endif
}

pair<int,pii> q[1001];
int arr[1001]={};

vector<pii> one_vale;

bool cmp(pii a,pii b)
{
    if(a.ss!=b.ss)
        a.ss < b.ss;

    return a.ff < b.ff;
}

int32_t main()
{
    c_p_c();
    int n,m; cin>>n>>m;

    for(int i=0;i<m;++i)
    {
        cin >> q[i].ff >> q[i].ss.ff >> q[i].ss.ss;

        if(q[i].ff==1)
           one_vale.pb(q[i].ss);
    }

    sort(one_vale.begin(), one_vale.end(),cmp);

    int sz = one_vale.size();

    if(sz)
    {
        int val = 10000005;

        for(int i=0;i<sz;++i)
        {
            for(int j=one_vale[i].ff;j<=one_vale[i].ss;++j)
                arr[j]=val;

            if(i+1<sz && one_vale[i+1].ff > one_vale[i].ss)
                val -= 1005;
        }
    }

    for(int i=1;i<=n;++i)
    {
        if(!arr[i])
        {
            if(i==1)
                arr[i]=100000005;
            else
                arr[i]=arr[i-1]-1;
        }
    }

    for(int i=0;i<m;++i)
    {
        if(q[i].ff==0)
        {
            bool found=0;
            for(int j=q[i].ss.ff;j<q[i].ss.ss;++j)
            {
                if(arr[j+1]<arr[j])
                {
                    found=1;
                    break;
                }
            }
            if(!found)
            {
                cout << "NO\n";
                return 0;
            }
        }
    }

    cout << "YES\n";

    for(int i=1;i<=n;++i)
        cout << arr[i] << ' ';

    return 0;
}


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

#define fastio          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define sze             200005
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define pr(x);          for(auto el : x) cout<<el<<' '; cout<<'\n';
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define mxel            max_element
#define mnel            min_element
#define db(...)         debug(#__VA_ARGS__, __VA_ARGS__)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename Arg1> void debug(const char* name, Arg1&& arg1){cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void debug(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " = " << arg1;
    debug(comma, args...);
}

void c_p_c()
{
    fastio;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("output.txt", "w", stderr);
    #endif
}

int arr[10001]={};

int32_t main()
{
    c_p_c();

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

    mii cnt;
    vector<pii> notsrt;

    while(m--)
    {
        int t,l,r; cin>>t>>l>>r;

        if(!t)
            notsrt.pb(mp(l,r));

        else
        {
            if(cnt.empty())
                cnt[l]=r;

            auto it = cnt.upper_bound(l);

            if(it==cnt.begin())
            {
                cnt[l]=r;
                it = cnt.upper_bound(r);
                it--;
                while(it->ff!=l)
                {
                    int end = it->ss;
                    cnt.erase(it);
                    cnt[l] = max(cnt[l],end);
                    r=cnt[l];

                    it = cnt.upper_bound(r);
                    it--;
                }
            }
            else
            {
                it--;
                int st;
                if(it->ss >= l)
                {
                    it->ss = max(r,it->ss);
                    r = it->ss;
                    st = it->ff;
                }
                else
                {
                    cnt[l]=r;
                    st = l;
                }

                it = cnt.upper_bound(r);
                it--;
                while(it->ff!=st)
                {
                    int end = it->ss;
                    cnt.erase(it);
                    cnt[st] = max(cnt[st],end);
                    r = cnt[st];

                    it = cnt.upper_bound(r);
                    it--;
                }
            }
        }
    }

    int val = 100000000;
    auto it = cnt.begin();

    while(it!=cnt.end())
    {
        //cout<<it->ff<<' '<<it->ss<<'\n';
        auto tmp = it;
        tmp++;

        for(int id=it->ff;id<=it->ss;++id)
            arr[id]=val;

        if(tmp!=cnt.end())
        {
            val -= (tmp->ff-it->ss+1);
        }
        it=tmp;
    }

    for(int i=1;i<=n;++i)
        if(!arr[i])
        {
            if(i==1)
                arr[i]=1000000000;
            else
                arr[i]=arr[i-1]-1;
        }

    for(auto el : notsrt)
    {
        bool found=0;

        for(int i=el.ff;i<el.ss;++i)
        {
            if(arr[i+1]<arr[i])
            {
                found=1;
                break;
            }
        }

        if(!found)
        {
            cout<<"NO\n";
            //return 0;
        }
    }

    cout<<"YES\n";

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


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

#define fastio          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define sze             200005
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define pr(x);          for(auto el : x) cout<<el<<' '; cout<<'\n';
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define mxel            max_element
#define mnel            min_element
#define db(...)         debug(#__VA_ARGS__, __VA_ARGS__)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename Arg1> void debug(const char* name, Arg1&& arg1){cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void debug(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " = " << arg1;
    debug(comma, args...);
}

void c_p_c()
{
    fastio;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("output.txt", "w", stderr);
    #endif
}

pair<int,pii> q[1001];
int arr[1001]={};

vector<pii> one_vale;

bool cmp(pii a,pii b)
{
    if(a.ss!=b.ss)
        a.ss > b.ss;

    return a.ff < b.ff;
}

int32_t main()
{
    c_p_c();
    int n,m; cin>>n>>m;

    for(int i=0;i<m;++i)
    {
        cin >> q[i].ff >> q[i].ss.ff >> q[i].ss.ss;

        if(q[i].ff==1)
           one_vale.pb(q[i].ss);
    }

    sort(one_vale.begin(), one_vale.end(),cmp);

    int sz = one_vale.size();

    if(sz)
    {
        int val = 100000;

        for(int i=0;i<sz;++i)
        {
            for(int j=one_vale[i].ff;j<=one_vale[i].ss;++j)
                arr[j]=val;

            if(i+1<sz && one_vale[i+1].ff > one_vale[i].ss)
                val--;
        }
    }

    for(int i=1;i<=n;++i)
    {
        if(!arr[i])
        {
            if(i==1)
                arr[i]=100001;
            else
                arr[i]=arr[i-1]-1;
        }
    }

    for(int i=0;i<m;++i)
    {
        if(q[i].ff==0)
        {
            bool found=0;
            for(int j=q[i].ss.ff;j<q[i].ss.ss;++j)
            {
                if(arr[j+1]<arr[j])
                {
                    found=1;
                    break;
                }
            }
            if(!found)
            {
                cout << "NO\n";
                return 0;
            }
        }
    }

    cout << "YES\n";

    for(int i=1;i<=n;++i)
        cout << arr[i] << ' ';

    return 0;
}


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

#define fastio          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define sze             200005
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define pr(x);          for(auto el : x) cout<<el<<' '; cout<<'\n';
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define mxel            max_element
#define mnel            min_element
#define db(...)         debug(#__VA_ARGS__, __VA_ARGS__)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename Arg1> void debug(const char* name, Arg1&& arg1){cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void debug(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " = " << arg1;
    debug(comma, args...);
}

void c_p_c()
{
    fastio;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("output.txt", "w", stderr);
    #endif
}

pair<int,pii> q[1001];
int arr[1001]={};

vector<pii> one_vale;

bool cmp(pii a,pii b)
{
    if(a.ss!=b.ss)
        return a.ss < b.ss;

    return a.ff < b.ff;
}

int32_t main()
{
    c_p_c();

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

    for(int i=0;i<m;++i)
    {
        cin >> q[i].ff >> q[i].ss.ff >> q[i].ss.ss;

        if(q[i].ff==1)
           one_vale.pb(q[i].ss);
    }

    sort(one_vale.begin(), one_vale.end(),cmp);

    int sz = one_vale.size();

    if(sz)
    {
        int val = 10000 - one_vale[0].ff + 1;

        for(int i=0;i<sz;++i)
        {
            for(int j=one_vale[i].ff;j<=one_vale[i].ss;++j)
                arr[j]=val;

            if(one_vale[i+1].ff > one_vale[i].ss)
                val -= (one_vale[i+1].ff - one_vale[i].ss);
        }
    }

    for(int i=1;i<=n;++i)
    {
        if(!arr[i])
        {
            if(i==1)
                arr[i]=10000;
            else
                arr[i]=arr[i-1]-1;
        }
    }

    for(int i=0;i<m;++i)
    {
        if(q[i].ff==0)
        {
            bool found=0;
            for(int j=q[i].ss.ff;j<q[i].ss.ss;++j)
            {
                if(arr[j+1]<arr[j])
                {
                    found=1;
                    break;
                }
            }
            if(!found)
            {
                cout << "NO\n";
                return 0;
            }
        }
    }

    cout << "YES\n";

    for(int i=1;i<=n;++i)
        cout << arr[i] << ' ';

    return 0;
}


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

#define fastio          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define sze             200005
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define pr(x);          for(auto el : x) cout<<el<<' '; cout<<'\n';
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define mxel            max_element
#define mnel            min_element
#define db(...)         debug(#__VA_ARGS__, __VA_ARGS__)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename Arg1> void debug(const char* name, Arg1&& arg1){cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void debug(const char* names, Arg1&& arg1, Args&&... args)
{
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " = " << arg1;
    debug(comma, args...);
}

void c_p_c()
{
    fastio;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("output.txt", "w", stderr);
    #endif
}

int arr[1001];

int32_t main()
{
    c_p_c();
    int n,m; cin>>n>>m;

    vector<pii> zero;

    while(m--)
    {
        int t,l,r; cin>>t>>l>>r;
        if(t)
        {
            for(int i=l+1;i<=r;++i)
                arr[i]=1;
        }
        else
        {
            zero.pb({l,r});
        }
    }

    arr[1]=100000;

    for(int i=2;i<=n;++i)
        if(arr[i])
            arr[i]=arr[i-1];
        else
            arr[i]=arr[i-1]-1;

    for(auto p : zero)
    {
        bool found=0;

        for(int i=p.ff;i<p.ss;++i)
            if(arr[i+1]<arr[i])
            {
                found=1;
                break;
            }
        if(!found)
        {
            cout<<"NO\n";
            return 0;
        }
    }

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