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

int n, a[100010];

int main()
{
    LL sum = 0;
    scanf("%d", &n);
    for (int i = 1;i <= n; ++i) scanf("%d", &a[i]), sum += a[i];
    sort(a+1, a+1+n);
    if (n >= 40) printf("%lld\n", sum-n);
    else
    {
        LL ans = 1e18;
        for (int i = 2;i <= 1e5; ++i)
        {
            LL tmp = 0, val = 1;
            bool ok = 1;
            for (int j = 0;j < n; ++j)
            {
                tmp += abs(a[j+1]-val);
                val *= i;
                if (val >= 1e14) ok = 0;
            }
            if (ok) ans = min(ans, tmp);
        }
        printf("%lld\n", ans);
    }

    return 0;
}


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

int n, a[100010];

int main()
{
    LL sum = 0;
    scanf("%d", &n);
    for (int i = 1;i <= n; ++i) scanf("%d", &a[i]), sum += a[i];
    sort(a+1, a+1+n);
    if (n >= 47) printf("%lld\n", sum-n);
    else
    {
        LL ans = 1e18;
        for (int i = 2;i <= 1e6; ++i)
        {
            LL tmp = 0, val = 1;
            bool ok = 1;
            for (int j = 0;j < n; ++j)
            {
                tmp += abs((LL)a[j+1]-val);
                val *= i;
                if (val >= 1e14) ok = 0;
            }
            if (ok) ans = min(ans, tmp);
        }
        printf("%lld\n", ans);
    }

    return 0;
}


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

int n, a[100010];

int main()
{
    LL sum = 0;
    scanf("%d", &n);
    for (int i = 1;i <= n; ++i) scanf("%d", &a[i]), sum += a[i];
    sort(a+1, a+1+n);
    if (n >= 40) printf("%lld\n", sum-n);
    else
    {
        LL ans = 1e18;
        for (int i = 2;i <= 1e6; ++i)
        {
            LL tmp = 0, val = 1;
            bool ok = 1;
            for (int j = 0;j < n; ++j)
            {
                tmp += abs(a[j+1]-val);
                val *= i;
                if (val >= 1e14) ok = 0;
            }
            if (ok) ans = min(ans, tmp);
        }
        printf("%lld\n", ans);
    }

    return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	cin>>a[i];
	sort(a,a+n);

	long long b[3]={0,0,0};
	long long sum;
	for(long long i=1;i<=100000;i++)//底数
	{
		sum=0;

		for(long long j=0;j<n;j++)//a[j
		sum+=abs(pow(i,j)-a[j]);

		if(i<=3)
		{
			b[i-1]=sum;
			continue;
		}

		if(i==3)
		{
			if(b[1]>b[0])
			{
				cout<<b[0];
				return 0;
			}
		} //第一项是低谷

		if(b[1]<=b[0]&&b[1]<=b[2])
		{
			cout<<b[1];
			return 0;
		}//误差低谷

		//cout<<b[1]<<endl<<b[0]<<endl<<b[2]<<endl;

		b[0]=b[1];
		b[1]=b[2];
		b[2]=sum;
		//cout<<"i="<<i<<endl;
	}
}
//3 1000000000 1000000000 1000000000


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;

typedef long long ll;

const int N = 1e5 + 5;
const long long INF = 4e16;

ll h[N];

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i ++ )
    {
        cin >> h[i];
    }
    sort(h + 1, h + 1 + n);
    long long res = INF;
    for (int c = 0; c <= h[n]; c ++ )
    {
    	bool flag = false;
        long long cnt = 0, ft = 0;
        for (int i = 1; i <= n; i ++ )
        {
        	if (i == 1)
        	{
        		ft = min(c, 1);
        	}
        	else
        	{
        		ft *= c;
        	}
    		if (c != 0 && i != 0 && ft > h[n] * c * c)
    		{
    			flag = true;
    			break;
    		}
            cnt += abs(h[i] - ft);
        }
        if (flag)
        	break;
        res = min(res, cnt);
    	if (c != 0 && ft > h[n])
    		break;
    }
    cout << res;
}


#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	cin>>a[i];
	sort(a,a+n-1);

	long long b[3]={0,0,0};
	long long sum,m=9223372036854775807;
	for(long long i=1;i<=pow(9223372036854775807,1.0/n);i++)//底数
	{
		sum=0;

		for(long long j=0;j<n;j++)//a[j
		sum+=abs(pow(i,j)-a[j]);

		m=min(m,sum);

	}cout<<m;
}
//3 1000000000 1000000000 1000000000


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define LONG_LONG_MAX 0xffffffffff
int main()
{
    ll n,i,j,k;
    ll a[100000+8];
    int c[100000+8];
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    sort(a+1,a+n+1);
    ll mmin=LONG_LONG_MAX;
    ll mmax=pow(LONG_LONG_MAX,1.0/n);
    for(i=1;i<=mmax;i++)
    {
        ll sum=0;
        ll tem=1;
        for(j=1;j<=n;j++)
        {
            sum+=abs(tem-a[j]);
            tem*=i;
        }
        mmin=min(mmin,sum);
    }
    cout<<mmin<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define LONG_LONG_MAX 0x7fffffffffffffff
#define int long long
using namespace std;
const int N=1e5+5;
int n,a[N],ans=LONG_LONG_MAX;
signed main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	sort(a+1,a+1+n);
	int t=pow(LONG_LONG_MAX,1.0/n);
	for(int i=1;i<=t;i++){
		int sum=0,tmp=1;
		for(int j=1;j<=n;j++)
			sum+=abs(tmp-a[j]),tmp*=i;
		ans=min(ans,sum);
	}
	printf("%lld",ans);
	return 0;
}


#include <bits/stdc++.h>
#define For(i,a,b) for ( int i=(a);i<=(b);i++ )
#define Dow(i,b,a) for ( int i=(b);i>=(a);i-- )
#define GO(i,x) for ( int i=head[x];i;i=e[i].nex )
#define mem(x,s) memset(x,s,sizeof(x))
#define cpy(x,s) memcpy(x,s,sizeof(x))
#define YES return puts("YES"),0
#define NO return puts("NO"),0
#define GG return puts("-1"),0
#define pb push_back
#define int long long
using namespace std;

struct IO
{
	#define MAXSIZE (1 << 20)
	#define isdigit(x) (x >= '0' && x <= '9')
  	char buf[MAXSIZE],*p1,*p2;
  	char pbuf[MAXSIZE],*pp;
  	IO():p1(buf),p2(buf),pp(pbuf){}
  	inline char gc() {
    	return getchar();
    	if (p1==p2) p2=(p1=buf)+fread(buf,1,MAXSIZE,stdin);
    	return p1==p2?' ':*p1++;
  	}
	inline bool blank(char ch) {return ch==' '||ch =='\n'||ch == '\r'||ch == '\t';}
  	template <class T>
  	inline void read(T &x)
	{
	    register double tmp=1;register bool sign=0; x=0;
	    register char ch=gc();
	    for (;!isdigit(ch);ch=gc()) if(ch=='-') sign=1;
	    for (;isdigit(ch);ch=gc()) x=x*10+(ch-'0');
	    if (ch=='.') for (ch=gc();isdigit(ch);ch=gc()) tmp/=10.0,x+=tmp*(ch-'0');
	    if (sign) x=-x;
  	}
  	inline void read(char *s)
	{
    	register char ch=gc();
		for (;blank(ch);ch=gc());
		for (;!blank(ch);ch=gc()) *s++=ch;
    	*s=0;
  	}
  	inline void read(char &c) {for(c=gc();blank(c);c=gc());}
  	template<class t> inline void write(t x){
		if(x<0) putchar('-'),write(-x);
		else{if(x>9) write(x/10);putchar('0'+x%10);}
	}
} io;

const int mod=1e9+7;
const int mo=998244353;
const int N=2e5+5;

int n,m,a[N],ans;

signed main()
{
	io.read(n);
	For(i,1,n) io.read(a[i]);
	sort(a+1,a+n+1);
	int ans=1e18,base=1;
	for (;;)
	{
		int x=1,sum=0;
		a[0]=0;
		For(i,1,n)
		{
			if(x>(int)1e14) a[0]=1;
			if(a[0]) break;
			sum+=abs(a[i]-x);
			x*=base;
		}
		if(a[0]) break;
		ans=min(ans,sum);
		base++;
	}
	io.write(ans);
	return 0;
}


#include <bits/stdc++.h>
#define long_long_max 0x7fffffffffffffff
typedef long long ll;
using namespace std;
const ll maxn = 1e5+5;
ll n,a[maxn],ans = long_long_max;
int main()
{
	cin >> n;
	for(int i=1;i<=n;i++)
		cin >> a[i];
	sort(a+1,a+n+1);
	ll t = pow(long_long_max,1.0/n);
//	cout << t << endl;
	for(ll i=1;i<=t;i++)
	{
		ll sum = 0,temp=1;//temp就是c
		for(ll j=1;j<=n;j++)
			sum+=abs(temp-a[j]),temp*=i;
		ans=min(ans,sum);
	}
	printf("%lld",ans);

	return 0;
}


#include<bits/stdc++.h>
#define fint register int
#define int long long
#define h 5001
#define p 475543
using namespace std;
const int inf=1e15;
const int maxn=1e5+1;
int a[p];
signed main()
{
	int n;
	cin>>n;
	for(fint i=0;i<n;i++)
	cin>>a[i];
	sort(a,a+n);
	int c=0,minns=inf;
	while(c<=maxn)
	{
		int ans=0;
		for(fint i=0;i<n;i++)
		{
			ans+=abs(a[i]-pow(c,i));
			if(ans>minns)
			break;
		}
		if(ans>minns)
		break;
		else
		minns=ans;
		c++;
	}
	cout<<minns;
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	cin>>a[i];
	sort(a,a+n-1);
	long long sum,m=9223372036854775807;
	for(long long i=1;i<=pow(9223372036854775807,1.0/n);i++)//底数
	{
		sum=0;

		for(long long j=0;j<n;j++)//a[j
		sum+=abs(pow(i,j)-a[j]);

		m=min(m,sum);

	}cout<<m;
}


/*
@ author:pyyyyyy
-----思路------

-----debug-------

*/

#include <bits/stdc++.h>
#include <cmath>
#include <math.h>
#define int long long
using namespace std;
inline int read() {
    char c = getchar();
    int x = 0, f = 1;
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
const int N = 102020;
int n, a[N];
int ans = 1e18, flag = 0;
int ksm(int a, int b){
	int ret = 1;
	while(b)
	{
		if(b & 1) ret *= a;
		a *= a;
		b >>= 1;
	}
	return ret;
}
signed main()
{
	//	freopen(".in","r",stdin);
	//	freopen(".out","w",stdout);
	n = read();
	for(int i = 0; i < n; ++i) a[i] = read();
	sort(a, a + n);
	for(int p = 1; p <= 1e18; ++p){
		if(flag) break;
		int now = 0;
		for(int i = 0; i < n; ++i){
			now += abs(a[i] - (ksm(p, i)));
			if(now > ans) {
				flag = 1;
				break;
			}
		}
		ans = min(ans, now);
	}
	cout << ans;
	return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define pb push_back
#define rsz resize
#define ins insert
#define all(x) (x).begin(), (x).end()
#define lb lower_bound
#define ub upper_bound
#define pqueue priority_queue

#define in(i, x) for (auto& (i):(x))
#define FIT(i, x) for (auto (i)=(x).begin(); (i)!=(x).end(); ++(i))
#define RIT(i, x) for (auto (i)=(x).rbegin(); (i)!=(x).rend(); ++(i))
#define finish(x) return print(x), 0

using ll=long long;
using db=double;
using ld=long double;
using pii=pair<int, int>;
using pll=pair<ll, ll>;
using pdd=pair<db, db>;
using vi=vector<int>;
using vl=vector<ll>;
using vd=vector<db>;
using vs=vector<string>;
using vii=vector<pii>;
using vll=vector<pll>;
using vdd=vector<pdd>;

template<class T> using mqueue=pqueue<T, vector<T>, greater<T>>;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<class T> bool ckmin(T& a, const T& b) { return (b<a)?a=b, 1:0; }
template<class T> bool ckmax(T& a, const T& b) { return (a<b)?a=b, 1:0; }

template<class T> void read(T& x) { cin >> x; }
template<class H, class T> void read(pair<H, T>& p) { cin >> p.fi >> p.se; }
template<class T> void read(vector<T>& v) { in(i, v) read(i); }
template<class H, class... T> void read(H& h, T&... t) { read(h); read(t...); }

template<class H, class T> ostream& operator<<(ostream& o, const pair<H, T> &p) { o << p.fi << " " << p.se; return o; }
template<class T> ostream& operator<<(ostream& o, vector<T> &v) { bool f=0; in(i, v) o << (f?" ":"") << i, f=1; return o; }
template<class H, class T> ostream& operator<<(ostream& o, vector<pair<H, T>> &v) { bool f=0; in(i, v) o << (f?"\n":"") << i, f=1; return o; }
template<class T> ostream& operator<<(ostream& o, vector<vector<T>> &v) { bool f=0; in(i, v) o << (f?"\n":"") << i, f=1; return o; }

template<class T> void write(T x) { cout << x; }
template<class H, class... T> void write(const H& h, const T&... t) { write(h); write(t...); }

void print() { write('\n'); }
template<class H, class... T> void print(const H& h, const T&... t) { write(h); if (sizeof...(t)) write(' '); print(t...); }

const ll M=1e9+7; //998244353;
const int kx[]={0,1,0,-1}, ky[]={1,0,-1,0};

int n;
ll ans;
vl a(n);

ll power(ll a, ll b) {
    ll ans=1;
    for (int i=0; i<b; ++i) {
        if (ans>1e10)
            return 1e18;
        ans*=a;
    }
    return ans;
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    read(n);
    a.rsz(n);
    read(a);
    sort(all(a));
    ll ans=LLONG_MAX;
    if (n>63) {
        ans=0;
        for (int i=0; i<n; ++i)
            ans+=abs(a[i]-i);
    }
    else {
        for (int i=1; power(i, n-1)<=ll(1e10); ++i) {
            ll cur=0;
            for (int j=0; j<n; ++j)
                cur+=abs(power(i, j)-a[j]);
            ans=min(ans, cur);
        }
    }
    print(ans);
    cerr << "Time elapsed: " << 1.0*clock()/CLOCKS_PER_SEC << "s\n";
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define pb push_back
#define rsz resize
#define ins insert
#define all(x) (x).begin(), (x).end()
#define lb lower_bound
#define ub upper_bound
#define pqueue priority_queue

#define in(i, x) for (auto& (i):(x))
#define FIT(i, x) for (auto (i)=(x).begin(); (i)!=(x).end(); ++(i))
#define RIT(i, x) for (auto (i)=(x).rbegin(); (i)!=(x).rend(); ++(i))
#define finish(x) return print(x), 0

using ll=long long;
using db=double;
using ld=long double;
using pii=pair<int, int>;
using pll=pair<ll, ll>;
using pdd=pair<db, db>;
using vi=vector<int>;
using vl=vector<ll>;
using vd=vector<db>;
using vs=vector<string>;
using vii=vector<pii>;
using vll=vector<pll>;
using vdd=vector<pdd>;

template<class T> using mqueue=pqueue<T, vector<T>, greater<T>>;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<class T> bool ckmin(T& a, const T& b) { return (b<a)?a=b, 1:0; }
template<class T> bool ckmax(T& a, const T& b) { return (a<b)?a=b, 1:0; }

template<class T> void read(T& x) { cin >> x; }
template<class H, class T> void read(pair<H, T>& p) { cin >> p.fi >> p.se; }
template<class T> void read(vector<T>& v) { in(i, v) read(i); }
template<class H, class... T> void read(H& h, T&... t) { read(h); read(t...); }

template<class H, class T> ostream& operator<<(ostream& o, const pair<H, T> &p) { o << p.fi << " " << p.se; return o; }
template<class T> ostream& operator<<(ostream& o, vector<T> &v) { bool f=0; in(i, v) o << (f?" ":"") << i, f=1; return o; }
template<class H, class T> ostream& operator<<(ostream& o, vector<pair<H, T>> &v) { bool f=0; in(i, v) o << (f?"\n":"") << i, f=1; return o; }
template<class T> ostream& operator<<(ostream& o, vector<vector<T>> &v) { bool f=0; in(i, v) o << (f?"\n":"") << i, f=1; return o; }

template<class T> void write(T x) { cout << x; }
template<class H, class... T> void write(const H& h, const T&... t) { write(h); write(t...); }

void print() { write('\n'); }
template<class H, class... T> void print(const H& h, const T&... t) { write(h); if (sizeof...(t)) write(' '); print(t...); }

const ll M=1e9+7; //998244353;
const int kx[]={0,1,0,-1}, ky[]={1,0,-1,0};

int n;
ll ans;
vl a(n);

ll power(ll a, ll b) {
    ll ans=1;
    for (int i=0; i<b; ++i) {
        if (ans>1e10)
            return 1e18;
        ans*=a;
    }
    return ans;
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    read(n);
    a.rsz(n);
    read(a);
    sort(all(a));
    ll ans=LLONG_MAX;
    if (n>63) {
        ans=0;
        for (int i=0; i<n; ++i)
            ans+=abs(a[i]-i);
    }
    else {
        for (int i=1; (ld)(n-1)*log(i)<=(ld)log(1e12); ++i) {
            ll cur=0;
            for (int j=0; j<n; ++j)
                cur+=abs(power(i, j)-a[j]);
            ans=min(ans, cur);
        }
    }
    print(ans);
    cerr << "Time elapsed: " << 1.0*clock()/CLOCKS_PER_SEC << "s\n";
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define pb push_back
#define rsz resize
#define ins insert
#define all(x) (x).begin(), (x).end()
#define lb lower_bound
#define ub upper_bound
#define pqueue priority_queue

#define in(i, x) for (auto& (i):(x))
#define FIT(i, x) for (auto (i)=(x).begin(); (i)!=(x).end(); ++(i))
#define RIT(i, x) for (auto (i)=(x).rbegin(); (i)!=(x).rend(); ++(i))
#define finish(x) return print(x), 0

using ll=long long;
using db=double;
using ld=long double;
using pii=pair<int, int>;
using pll=pair<ll, ll>;
using pdd=pair<db, db>;
using vi=vector<int>;
using vl=vector<ll>;
using vd=vector<db>;
using vs=vector<string>;
using vii=vector<pii>;
using vll=vector<pll>;
using vdd=vector<pdd>;

template<class T> using mqueue=pqueue<T, vector<T>, greater<T>>;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<class T> bool ckmin(T& a, const T& b) { return (b<a)?a=b, 1:0; }
template<class T> bool ckmax(T& a, const T& b) { return (a<b)?a=b, 1:0; }

template<class T> void read(T& x) { cin >> x; }
template<class H, class T> void read(pair<H, T>& p) { cin >> p.fi >> p.se; }
template<class T> void read(vector<T>& v) { in(i, v) read(i); }
template<class H, class... T> void read(H& h, T&... t) { read(h); read(t...); }

template<class H, class T> ostream& operator<<(ostream& o, const pair<H, T> &p) { o << p.fi << " " << p.se; return o; }
template<class T> ostream& operator<<(ostream& o, vector<T> &v) { bool f=0; in(i, v) o << (f?" ":"") << i, f=1; return o; }
template<class H, class T> ostream& operator<<(ostream& o, vector<pair<H, T>> &v) { bool f=0; in(i, v) o << (f?"\n":"") << i, f=1; return o; }
template<class T> ostream& operator<<(ostream& o, vector<vector<T>> &v) { bool f=0; in(i, v) o << (f?"\n":"") << i, f=1; return o; }

template<class T> void write(T x) { cout << x; }
template<class H, class... T> void write(const H& h, const T&... t) { write(h); write(t...); }

void print() { write('\n'); }
template<class H, class... T> void print(const H& h, const T&... t) { write(h); if (sizeof...(t)) write(' '); print(t...); }

const ll M=1e9+7; //998244353;
const int kx[]={0,1,0,-1}, ky[]={1,0,-1,0};

int n;
ll ans;
vl a(n);

ll binpow(ll a, ll b) {
    ll ans=1;
    while (b>0) {
        if (b&1)
            ans*=a;
        a*=a, b>>=1;
    }
    return ans;
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    read(n);
    a.rsz(n);
    read(a);
    sort(all(a));
    ll ans=LLONG_MAX;
    for (int i=1; (ld)(n-1)*log(i)<=(ld)log(1e10); ++i) {
        ll cur=0;
        for (int j=0; j<n; ++j)
            cur+=abs(binpow(i, j)-a[j]);
        ans=min(ans, cur);
    }
    print(ans);
    cerr << "Time elapsed: " << 1.0*clock()/CLOCKS_PER_SEC << "s\n";
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define pb push_back
#define rsz resize
#define ins insert
#define all(x) (x).begin(), (x).end()
#define lb lower_bound
#define ub upper_bound
#define pqueue priority_queue

#define in(i, x) for (auto& (i):(x))
#define FIT(i, x) for (auto (i)=(x).begin(); (i)!=(x).end(); ++(i))
#define RIT(i, x) for (auto (i)=(x).rbegin(); (i)!=(x).rend(); ++(i))
#define finish(x) return print(x), 0

using ll=long long;
using db=double;
using ld=long double;
using pii=pair<int, int>;
using pll=pair<ll, ll>;
using pdd=pair<db, db>;
using vi=vector<int>;
using vl=vector<ll>;
using vd=vector<db>;
using vs=vector<string>;
using vii=vector<pii>;
using vll=vector<pll>;
using vdd=vector<pdd>;

template<class T> using mqueue=pqueue<T, vector<T>, greater<T>>;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<class T> bool ckmin(T& a, const T& b) { return (b<a)?a=b, 1:0; }
template<class T> bool ckmax(T& a, const T& b) { return (a<b)?a=b, 1:0; }

template<class T> void read(T& x) { cin >> x; }
template<class H, class T> void read(pair<H, T>& p) { cin >> p.fi >> p.se; }
template<class T> void read(vector<T>& v) { in(i, v) read(i); }
template<class H, class... T> void read(H& h, T&... t) { read(h); read(t...); }

template<class H, class T> ostream& operator<<(ostream& o, const pair<H, T> &p) { o << p.fi << " " << p.se; return o; }
template<class T> ostream& operator<<(ostream& o, vector<T> &v) { bool f=0; in(i, v) o << (f?" ":"") << i, f=1; return o; }
template<class H, class T> ostream& operator<<(ostream& o, vector<pair<H, T>> &v) { bool f=0; in(i, v) o << (f?"\n":"") << i, f=1; return o; }
template<class T> ostream& operator<<(ostream& o, vector<vector<T>> &v) { bool f=0; in(i, v) o << (f?"\n":"") << i, f=1; return o; }

template<class T> void write(T x) { cout << x; }
template<class H, class... T> void write(const H& h, const T&... t) { write(h); write(t...); }

void print() { write('\n'); }
template<class H, class... T> void print(const H& h, const T&... t) { write(h); if (sizeof...(t)) write(' '); print(t...); }

const ll M=1e9+7; //998244353;
const int kx[]={0,1,0,-1}, ky[]={1,0,-1,0};

int n;
ll ans;
vl a(n);

ll binpow(ll a, ll b) {
    ll ans=1;
    while (b>0) {
        if (b&1)
            ans*=a;
        a*=a, b>>=1;
    }
    return ans;
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    read(n);
    a.rsz(n);
    read(a);
    sort(all(a));
    ll ans=LLONG_MAX;
    for (int i=1; binpow(i, n-1)<=ll(1e12); ++i) {
        ll cur=0;
        for (int j=0; j<n; ++j)
            cur+=abs(binpow(i, j)-a[j]);
        ans=min(ans, cur);
    }
    print(ans);
    cerr << "Time elapsed: " << 1.0*clock()/CLOCKS_PER_SEC << "s\n";
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define pb push_back
#define rsz resize
#define ins insert
#define all(x) (x).begin(), (x).end()
#define lb lower_bound
#define ub upper_bound
#define pqueue priority_queue

#define in(i, x) for (auto& (i):(x))
#define FIT(i, x) for (auto (i)=(x).begin(); (i)!=(x).end(); ++(i))
#define RIT(i, x) for (auto (i)=(x).rbegin(); (i)!=(x).rend(); ++(i))
#define finish(x) return print(x), 0

using ll=long long;
using db=double;
using ld=long double;
using pii=pair<int, int>;
using pll=pair<ll, ll>;
using pdd=pair<db, db>;
using vi=vector<int>;
using vl=vector<ll>;
using vd=vector<db>;
using vs=vector<string>;
using vii=vector<pii>;
using vll=vector<pll>;
using vdd=vector<pdd>;

template<class T> using mqueue=pqueue<T, vector<T>, greater<T>>;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<class T> bool ckmin(T& a, const T& b) { return (b<a)?a=b, 1:0; }
template<class T> bool ckmax(T& a, const T& b) { return (a<b)?a=b, 1:0; }

template<class T> void read(T& x) { cin >> x; }
template<class H, class T> void read(pair<H, T>& p) { cin >> p.fi >> p.se; }
template<class T> void read(vector<T>& v) { in(i, v) read(i); }
template<class H, class... T> void read(H& h, T&... t) { read(h); read(t...); }

template<class H, class T> ostream& operator<<(ostream& o, const pair<H, T> &p) { o << p.fi << " " << p.se; return o; }
template<class T> ostream& operator<<(ostream& o, vector<T> &v) { bool f=0; in(i, v) o << (f?" ":"") << i, f=1; return o; }
template<class H, class T> ostream& operator<<(ostream& o, vector<pair<H, T>> &v) { bool f=0; in(i, v) o << (f?"\n":"") << i, f=1; return o; }
template<class T> ostream& operator<<(ostream& o, vector<vector<T>> &v) { bool f=0; in(i, v) o << (f?"\n":"") << i, f=1; return o; }

template<class T> void write(T x) { cout << x; }
template<class H, class... T> void write(const H& h, const T&... t) { write(h); write(t...); }

void print() { write('\n'); }
template<class H, class... T> void print(const H& h, const T&... t) { write(h); if (sizeof...(t)) write(' '); print(t...); }

const ll M=1e9+7; //998244353;
const int kx[]={0,1,0,-1}, ky[]={1,0,-1,0};

int n;
ll ans;
vl a(n);

ll power(ll a, ll b) {
    ll ans=1;
    for (int i=0; i<b; ++i) {
        if (ans>1e10)
            return 1e18;
        ans*=a;
    }
    return ans;
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    read(n);
    a.rsz(n);
    read(a);
    sort(all(a));
    ll ans=LLONG_MAX;
    if (n>63) {
        for (int i=0; i<n; ++i)
            ans+=abs(a[i]-i);
    }
    else {
        for (int i=1; power(i, n-1)<=ll(1e12); ++i) {
            ll cur=0;
            for (int j=0; j<n; ++j)
                cur+=abs(power(i, j)-a[j]);
            ans=min(ans, cur);
        }
    }
    print(ans);
    cerr << "Time elapsed: " << 1.0*clock()/CLOCKS_PER_SEC << "s\n";
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define pb push_back
#define rsz resize
#define ins insert
#define all(x) (x).begin(), (x).end()
#define lb lower_bound
#define ub upper_bound
#define pqueue priority_queue

#define in(i, x) for (auto& (i):(x))
#define FIT(i, x) for (auto (i)=(x).begin(); (i)!=(x).end(); ++(i))
#define RIT(i, x) for (auto (i)=(x).rbegin(); (i)!=(x).rend(); ++(i))
#define finish(x) return print(x), 0

using ll=long long;
using db=double;
using ld=long double;
using pii=pair<int, int>;
using pll=pair<ll, ll>;
using pdd=pair<db, db>;
using vi=vector<int>;
using vl=vector<ll>;
using vd=vector<db>;
using vs=vector<string>;
using vii=vector<pii>;
using vll=vector<pll>;
using vdd=vector<pdd>;

template<class T> using mqueue=pqueue<T, vector<T>, greater<T>>;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<class T> bool ckmin(T& a, const T& b) { return (b<a)?a=b, 1:0; }
template<class T> bool ckmax(T& a, const T& b) { return (a<b)?a=b, 1:0; }

template<class T> void read(T& x) { cin >> x; }
template<class H, class T> void read(pair<H, T>& p) { cin >> p.fi >> p.se; }
template<class T> void read(vector<T>& v) { in(i, v) read(i); }
template<class H, class... T> void read(H& h, T&... t) { read(h); read(t...); }

template<class H, class T> ostream& operator<<(ostream& o, const pair<H, T> &p) { o << p.fi << " " << p.se; return o; }
template<class T> ostream& operator<<(ostream& o, vector<T> &v) { bool f=0; in(i, v) o << (f?" ":"") << i, f=1; return o; }
template<class H, class T> ostream& operator<<(ostream& o, vector<pair<H, T>> &v) { bool f=0; in(i, v) o << (f?"\n":"") << i, f=1; return o; }
template<class T> ostream& operator<<(ostream& o, vector<vector<T>> &v) { bool f=0; in(i, v) o << (f?"\n":"") << i, f=1; return o; }

template<class T> void write(T x) { cout << x; }
template<class H, class... T> void write(const H& h, const T&... t) { write(h); write(t...); }

void print() { write('\n'); }
template<class H, class... T> void print(const H& h, const T&... t) { write(h); if (sizeof...(t)) write(' '); print(t...); }

const ll M=1e9+7; //998244353;
const int kx[]={0,1,0,-1}, ky[]={1,0,-1,0};

int n;
ll ans;
vl a(n);

ll binpow(ll a, ll b) {
    ll ans=1;
    while (b>0) {
        if (b&1)
            ans*=a;
        a*=a, b>>=1;
    }
    return ans;
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    read(n);
    a.rsz(n);
    read(a);
    sort(all(a));
    ll ans=LLONG_MAX;
    for (int i=1; binpow(i, n-1)<=ll(1e10); ++i) {
        ll cur=0;
        for (int j=0; j<n; ++j)
            cur+=abs(binpow(i, j)-a[j]);
        ans=min(ans, cur);
    }
    print(ans);
    cerr << "Time elapsed: " << 1.0*clock()/CLOCKS_PER_SEC << "s\n";
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define pb push_back
#define rsz resize
#define ins insert
#define all(x) (x).begin(), (x).end()
#define lb lower_bound
#define ub upper_bound
#define pqueue priority_queue

#define in(i, x) for (auto& (i):(x))
#define FIT(i, x) for (auto (i)=(x).begin(); (i)!=(x).end(); ++(i))
#define RIT(i, x) for (auto (i)=(x).rbegin(); (i)!=(x).rend(); ++(i))
#define finish(x) return print(x), 0

using ll=long long;
using db=double;
using ld=long double;
using pii=pair<int, int>;
using pll=pair<ll, ll>;
using pdd=pair<db, db>;
using vi=vector<int>;
using vl=vector<ll>;
using vd=vector<db>;
using vs=vector<string>;
using vii=vector<pii>;
using vll=vector<pll>;
using vdd=vector<pdd>;

template<class T> using mqueue=pqueue<T, vector<T>, greater<T>>;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<class T> bool ckmin(T& a, const T& b) { return (b<a)?a=b, 1:0; }
template<class T> bool ckmax(T& a, const T& b) { return (a<b)?a=b, 1:0; }

template<class T> void read(T& x) { cin >> x; }
template<class H, class T> void read(pair<H, T>& p) { cin >> p.fi >> p.se; }
template<class T> void read(vector<T>& v) { in(i, v) read(i); }
template<class H, class... T> void read(H& h, T&... t) { read(h); read(t...); }

template<class H, class T> ostream& operator<<(ostream& o, const pair<H, T> &p) { o << p.fi << " " << p.se; return o; }
template<class H, class T> ostream& operator<<(ostream& o, vector<pair<H, T>> &v) { bool f=0; in(i, v) o << (f?"\n":"") << i, f=1; return o; }
template<class T> ostream& operator<<(ostream& o, vector<T> &v) { bool f=0; in(i, v) o << (f?" ":"") << i, f=1; return o; }
template<class T> ostream& operator<<(ostream& o, vector<vector<T>> &v) { bool f=0; in(i, v) o << (f?"\n":"") << i, f=1; return o; }

template<class T> void write(T x) { cout << x; }
template<class H, class... T> void write(const H& h, const T&... t) { write(h); write(t...); }

void print() { write('\n'); }
template<class H, class... T> void print(const H& h, const T&... t) { write(h); if (sizeof...(t)) write(' '); print(t...); }

const ll M=1e9+7; //998244353;
const int kx[]={0,1,0,-1}, ky[]={1,0,-1,0};

int main() {
    cin.tie(0)->sync_with_stdio(0);
    int t; read(t);
    while (t--) {
        int n; read(n);
        vs a(n); read(a);
        map<char, int> m;
        for (int i=0; i<n; ++i)
            for (auto c:a[i])
                ++m[c];
        bool f=0;
        for (char c='a'; c!='z'; ++c)
            if (m[c]%n)
                f=1;
        print(f?"NO":"YES");
    }
    cerr << "Time elapsed: " << 1.0*clock()/CLOCKS_PER_SEC << "s\n";
}


#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define int  long long int
	#define pb push_back
	#define fe first
	#define se second
	#define endl "\n"
	#define pii pair<int, int>
	#define vi vector<int>
	#define vvi vector<vi>
	#define REP(i,n) for(int i=0;i<n;i++)
	#define FOR(i,a,b) for(int i=a;i<=b;i++)
	#define FORR(i,a,b) for(int i=a;i>=b;i--)
	#define ALL(c) (c).begin(),()c.end()

	#define PI 3.14159265358979323846
	const int N =1e3+10;

    int mod=1e9+7;

      int a[N];
     void solve(){
          int n,q,f=0;
          cin>>n>>q;

          vector<pii> vp;

          int last=0;

          while(q--){
              int x,y,z;
              cin>>x>>y>>z;
              if(x){
                  for(int i=y;i<z;i++){
                     a[i]=1;
                   }
                   last=z;
              }

              else{
                vp.pb({y,z});
              }
          }

          a[last]=1;

          sort(vp.begin(),vp.end());
          for(int i=0;i<vp.size();i++){
               int l=vp[i].fe;
               int r=vp[i].se;

               int yo=0;
               for(int j=l;j<=r;j++){
                   if(a[j]==1)
                     continue;
                   else
                     yo=1;
               }

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

          int alfa=100000;

          for(int i=0;i<vp.size();i++){
              int l=vp[i].fe;
              int r=vp[i].se;

              for(int j=l;j<r;j++){
                  if(a[j])
                   continue;
                 else
                  a[j]=alfa--;
              }
          }

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

         }

	int32_t main() {

	  cool;
	  int t=1;

	  while (t--)
		 solve();

	  return 0;
	}


#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define int  long long int
	#define pb push_back
	#define fe first
	#define se second
	#define endl "\n"
	#define pii pair<int, int>
	#define vi vector<int>
	#define vvi vector<vi>
	#define REP(i,n) for(int i=0;i<n;i++)
	#define FOR(i,a,b) for(int i=a;i<=b;i++)
	#define FORR(i,a,b) for(int i=a;i>=b;i--)
	#define ALL(c) (c).begin(),()c.end()

	#define PI 3.14159265358979323846
	const int N =1e5+10;

    int mod=1e9+7;

     void solve(){
          int n,q,f=0;
          cin>>n>>q;
          vi wyn(n+1);
          vector<pair<pii,int> > v;

          while(q--){
              int a,b,c;
              cin>>a>>b>>c;
              v.pb({{b,c},a});
          }

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

          for(int i=0;i<v.size()-1;i++){
              int l1=v[i].fe.fe;
              int r1=v[i].fe.se;
              int nax1=v[i].se;

              int l2=v[i+1].fe.fe;
              int r2=v[i+1].fe.se;
              int nax2=v[i+1].se;

              if(nax1!=nax2){
                  if( (l2>=l1 && r2<=r1 && l2<=r1 && r2>=l1) ){
                      f++;
                      break;
                  }
              }
          }

          if(f){
            cout<<"NO";
            return;
          }

         else{
               int tot=1e8;
               for(int i=1;i<=n;i++)
                 wyn[i]=tot--;

                for(int i=0;i<v.size();i++){
                 int x1=v[i].fe.fe;
                 int x2= v[i].fe.se;
                 int kie=v[i].se;
                 //cout<<" kie "<<kie<<endl;

                 if(kie==1){
                    // cout<<"1 "<<endl;
                     for(int i=x1;i<x2;i++){
                         if(wyn[i+1]<wyn[i])
                            wyn[i+1]=wyn[i];
                     }
                 }

                 else {
                       // cout<<"2 "<<endl;
                          for(int i=x1;i<x2;i++){
                         if(wyn[i+1]>wyn[i])
                           wyn[i+1]=(wyn[i]==1?++wyn[i]:wyn[i])-1;
                     }
                 }
              }
            }

            cout<<"YES\n";

            for(int i=1;i<wyn.size();i++)
              cout<<wyn[i]<<" ";
         }

	int32_t main() {

	  cool;
	  int t=1;

	  while (t--)
		 solve();

	  return 0;
	}


#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define int  long long int
	#define pb push_back
	#define fe first
	#define se second
	#define endl "\n"
	#define pii pair<int, int>
	#define vi vector<int>
	#define vvi vector<vi>
	#define REP(i,n) for(int i=0;i<n;i++)
	#define FOR(i,a,b) for(int i=a;i<=b;i++)
	#define FORR(i,a,b) for(int i=a;i>=b;i--)
	#define ALL(c) (c).begin(),()c.end()

	#define PI 3.14159265358979323846
	const int N =1e3+10;

    int mod=1e9+7;

      int a[N];
     void solve(){
          int n,q,f=0;
          cin>>n>>q;

          vector<pii> vp;

          int last=0;

          while(q--){
              int x,y,z;
              cin>>x>>y>>z;
              if(x){
                  for(int i=y;i<z;i++){
                     a[i]=1;
                   }

              }

              else{
                vp.pb({y,z});
              }
          }

          sort(vp.begin(),vp.end());
          for(int i=0;i<vp.size();i++){
               int l=vp[i].fe;
               int r=vp[i].se;

               int yo=0;
               for(int j=l;j<r;j++){
                   if(a[j]==1)
                     continue;
                   else
                     yo=1;
               }

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

          int alfa=100000;

          cout<<"YES\n";
          cout<<alfa<<" ";
        for(int i=2;i<=n;i++)
           cout<<(a[i-1]?alfa:--alfa)<<" ";

         }

	int32_t main() {

	  cool;
	  int t=1;

	  while (t--)
		 solve();

	  return 0;
	}


#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define int  long long int
	#define pb push_back
	#define fe first
	#define se second
	#define endl "\n"
	#define pii pair<int, int>
	#define vi vector<int>
	#define vvi vector<vi>
	#define REP(i,n) for(int i=0;i<n;i++)
	#define FOR(i,a,b) for(int i=a;i<=b;i++)
	#define FORR(i,a,b) for(int i=a;i>=b;i--)
	#define ALL(c) (c).begin(),()c.end()

	#define PI 3.14159265358979323846
	const int N =1e3+10;

    int mod=1e9+7;

      int a[N];
     void solve(){
          int n,q,f=0;
          cin>>n>>q;

          vector<pii> vp;

          int last=0;

          while(q--){
              int x,y,z;
              cin>>x>>y>>z;
              if(x){
                  for(int i=y;i<z;i++){
                     a[i]=1;
                   }
              }

              else{
                vp.pb({y,z});
              }
          }

          //cout<<vp.size()<<endl;

          for(int i=0;i<vp.size();i++){
             int l=vp[i].fe;
             int r=vp[i].se;
            int cnt=0;
             for(int j=l;j<r;j++){
               if(a[j]==0 && cnt==0){
                   a[j]=-1;
                   cnt++;
               }
             }

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

          //~ for(int i=1;i<=n;i++)
             //~ cout<<a[i]<<" ";
             //~ cout<<endl;
          cout<<"YES\n";
          int alfa=1e9;
               for(int i=1;i<=n;i++){

                  cout<<alfa<<" " ;
                  if(a[i]==-1)
                   --alfa;
               }
         }

	int32_t main() {

	  cool;
	  int t=1;

	  while (t--)
		 solve();

	  return 0;
	}


#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define int  long long int
	#define pb push_back
	#define fe first
	#define se second
	#define endl "\n"
	#define pii pair<int, int>
	#define vi vector<int>
	#define vvi vector<vi>
	#define REP(i,n) for(int i=0;i<n;i++)
	#define FOR(i,a,b) for(int i=a;i<=b;i++)
	#define FORR(i,a,b) for(int i=a;i>=b;i--)
	#define ALL(c) (c).begin(),()c.end()

	#define PI 3.14159265358979323846
	const int N =1e5+10;

    int mod=1e9+7;

     void solve(){
          int n,q,f=0;
          cin>>n>>q;
          vi wyn(n+1);
          vector<pair<pii,int> > v;

          while(q--){
              int a,b,c;
              cin>>a>>b>>c;
              v.pb({{b,c},a});
          }

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

          for(int i=0;i<v.size()-1;i++){
              int l1=v[i].fe.fe;
              int r1=v[i].fe.se;
              int nax1=v[i].se;

              int l2=v[i+1].fe.fe;
              int r2=v[i+1].fe.se;
              int nax2=v[i+1].se;

              if(nax1!=nax2){
                  if( (r2<r1) ||  (l2<r1)){
                      f++;
                      break;
                  }
              }
          }

          if(f){
            cout<<"NO";
            return;
          }

         else{
               int tot=1000;
               for(int i=1;i<=n;i++)
                 wyn[i]=tot--;

                for(int i=0;i<v.size();i++){
                 int x1=v[i].fe.fe;
                 int x2= v[i].fe.se;
                 int kie=v[i].se;
                 //cout<<" kie "<<kie<<endl;

                 if(kie==1){
                    // cout<<"1 "<<endl;
                     for(int i=x1;i<x2;i++){
                         if(wyn[i+1]<wyn[i])
                            wyn[i+1]=wyn[i]+1;
                     }
                 }

                 else {
                       // cout<<"2 "<<endl;
                          for(int i=x1;i<x2;i++){
                         if(wyn[i+1]>wyn[i])
                           wyn[i+1]=(wyn[i]==1?++wyn[i]:wyn[i])-1;
                     }
                 }
              }
            }

            cout<<"YES\n";

            for(int i=1;i<wyn.size();i++)
              cout<<wyn[i]<<" ";
         }

	int32_t main() {

	  cool;
	  int t=1;

	  while (t--)
		 solve();

	  return 0;
	}


#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define int  long long int
	#define pb push_back
	#define fe first
	#define se second
	#define endl "\n"
	#define pii pair<int, int>
	#define vi vector<int>
	#define vvi vector<vi>
	#define REP(i,n) for(int i=0;i<n;i++)
	#define FOR(i,a,b) for(int i=a;i<=b;i++)
	#define FORR(i,a,b) for(int i=a;i>=b;i--)
	#define ALL(c) (c).begin(),()c.end()

	#define PI 3.14159265358979323846
	const int N =1e5+10;

    int mod=1e9+7;

     void solve(){
          int n,q,f=0;
          cin>>n>>q;
          vi wyn(n+1);
          vector<pair<pii,int> > v;

          while(q--){
              int a,b,c;
              cin>>a>>b>>c;
              v.pb({{b,c},a});
          }

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

          for(int i=0;i<v.size()-1;i++){
              int l1=v[i].fe.fe;
              int r1=v[i].fe.se;
              int nax1=v[i].se;

              int l2=v[i+1].fe.fe;
              int r2=v[i+1].fe.se;
              int nax2=v[i+1].se;

              if(nax1!=nax2){
                  if( (l2>l1 && r2<r1) ){
                      f++;
                      break;
                  }
              }
          }

          if(f){
            cout<<"NO";
            return;
          }

         else{
               int tot=1e9;
               for(int i=1;i<=n;i++)
                 wyn[i]=tot--;

                for(int i=0;i<v.size();i++){
                 int x1=v[i].fe.fe;
                 int x2= v[i].fe.se;
                 int kie=v[i].se;
                 //cout<<" kie "<<kie<<endl;

                 if(kie==1){
                    // cout<<"1 "<<endl;
                     for(int i=x1;i<x2;i++){
                         if(wyn[i+1]<wyn[i])
                            wyn[i+1]=wyn[i]+1;
                     }
                 }

                 else {
                       // cout<<"2 "<<endl;
                          for(int i=x1;i<x2;i++){
                         if(wyn[i+1]>wyn[i])
                           wyn[i+1]=(wyn[i]==1?++wyn[i]:wyn[i])-1;
                     }
                 }
              }
            }

            cout<<"YES\n";

            for(int i=1;i<wyn.size();i++)
              cout<<wyn[i]<<" ";
         }

	int32_t main() {

	  cool;
	  int t=1;

	  while (t--)
		 solve();

	  return 0;
	}


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

typedef long long ll;
const ll MXN = 1e3 + 10;
ll n, m, l, r, t, a = 1;
ll A[MXN];
vector<pair<ll, ll>> vec;
vector<ll> Ans;
bool mark[MXN];
int main(){
    ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for(int i = 0; i < m; i ++){
        cin >> t >> l >> r;
        if(!t) vec.emplace_back(l, r);
        else{
            for(int j = l + 1; j <= r; j ++) mark[j] = 1;
        }
    }
    for(auto[l, r] : vec){
        bool f = 0;
        for(int i = l + 1; i <= r; i ++) if(!mark[i]) f = 1;
        if(!f) return cout << "NO", 0;
    }
    cout << "YES" << '\n';
    for(int i = n; i; i --) Ans.push_back(a = a + 1 - mark[i + 1]);
    reverse(Ans.begin(), Ans.end());
    for(auto X : Ans) cout << X << ' ';
    return 0;
}
/*!
    Be careful who you share your weaknesses with.
    Some people can't wait for the opportunity to use them against you!!
*/
//! N.N


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

typedef long long                   ll;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define F                           first
#define S                           second
#define sep                         ' '
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(x)                    cerr << "$$$ " << x << '\n';
#define error2(x,y)                 cerr << "#F : " << x << "      #S : " << y << '\n';
#define pb                          push_back

const ll MX5 = 3*1e5+3;
const ll MX6 = 1*1e6+37;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
const ll MOD2= 998244353;

ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
ll bmm(ll a,ll b){
    return (a%b==0 ? b : bmm(b,a%b));
}

ll A[MX5],n,m;
vector<pair<ll,pll> > Q;
int main(){
    fast_io
    //file_io
    cin >> n >> m;
    fill(A,A+n+3,1);
    for(int i=0;i<m;i++){
        ll t,l,r;
        cin >> t >> l >> r;
        Q.pb({!t,{l,r}});
    }
    Sort(Q);
    for(int i=0;i<m;i++){
          //  for(int j=1;j<=n;j++) cout << A[j] << sep;
            //cout << endl;
        ll t=!Q[i].F;
        ll l=(Q[i].S).F,r=(Q[i].S).S;
        if(t){
            for(int h=l+1;h<=r;h++){
                if(A[h]==1){
                    A[h]=A[h-1]+1;
                }

                else{
                    if(A[h]<A[h-1]){
                        A[h]=A[h-1];
                    }
                }
            }
        }
        else{
            if(A[r]>=A[l]) A[r]=A[l]-1;

        }
    }
    for(int i=0;i<m;i++){
        ll t=!Q[i].F;
        ll l=(Q[i].S).F,r=(Q[i].S).S;
        if(t){
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    cout << "NO";
                    return 0;
                }
            }
        }
        else{
            bool f=0;
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    f=1;
                }
            }
            if(f==0){
                cout << "NO";
                return 0;
            }
        }
    }
    ll ttt=0;
    ll mini=INF;
    for(int i=1;i<=n;i++) mini=min(mini,A[i]);
    if(mini<1){
        ttt=1-mini;
    }
    cout << "YES" << endl;
    for(int i=1;i<=n;i++) cout << A[i]+ttt << sep;
    return 0;
}

/*!
NNNNNNNN        NNNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM                AAA
N;;;;;;;N       N;;;;;;N I::::::::I M;;;;;;;M             M;;;;;;;M               A:::A
N;;;;;;;;N      N;;;;;;N I::::::::I M;;;;;;;;M           M;;;;;;;;M              A\N.N/A
N;;;;;;;;;N     N;;;;;;N II::::::II M;;;;;;;;;M         M;;;;;;;;;M             A:::::::A
N;;;;;;;;;;N    N;;;;;;N   I::::I   M;;;;;;;;;;M       M;;;;;;;;;;M            A:::::::::A
N;;;;;;;;;;;N   N;;;;;;N   I::::I   M;;;;;;;;;;;M     M;;;;;;;;;;;M           A:::::A:::::A
N;;;;;;;N;;;;N  N;;;;;;N   I::::I   M:::::::M;;;;M   M;;;;M;;;;;;;M          A:::::A A:::::A
N;;;;;;N N;;;;N N;;;;;;N   I::::I   M;;;;;;M M;;;;M M;;;;M M;;;;;;M         A:::::A   A:::::A
N;;;;;;N  N;;;;N;;;;;;;N   I::::I   M;;;;;;M  M;;;;M;;;;M  M;;;;;;M        A:::::A     A:::::A
N;;;;;;N   N;;;;;;;;;;;N   I::::I   M;;;;;;M   M\\N.N//M   M;;;;;;M       A:::::AAAAAAAAA:::::A
N;;;;;;N    N;;;;;;;;;;N   I::::I   M;;;;;;M    M;;;;;M    M;;;;;;M      A:::In GOD we trust:::A
N;;;;;;N     N;;;;;;;;;N   I::::I   M;;;;;;M     MMMMM     M;;;;;;M     A:::::AAAAAAAAAAAAA:::::A
N;;;;;;N      N;;;;;;;;N II::::::II M;;;;;;M               M;;;;;;M    A:::::A             A:::::A
N;;;;;;N       N;;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M   A:::::A               A:::::A
N;;;;;;N        N;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M  A:::::A                 A:::::A
NNNNNNNN         NNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM AAAAAAA                   AAAAAAA
*/


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

typedef long long                   ll;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define F                           first
#define S                           second
#define sep                         ' '
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(x)                    cerr << "$$$ " << x << '\n';
#define error2(x,y)                 cerr << "#F : " << x << "      #S : " << y << '\n';
#define pb                          push_back

const ll MX5 = 3*1e5+3;
const ll MX6 = 1*1e6+37;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
const ll MOD2= 998244353;

ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
ll bmm(ll a,ll b){
    return (a%b==0 ? b : bmm(b,a%b));
}

ll A[MX5],n,m;
vector<pair<ll,pll> > Q;
int main(){
    fast_io
    //file_io
    cin >> n >> m;
    fill(A,A+n+3,1);
    for(int i=0;i<m;i++){
        ll t,l,r;
        cin >> t >> l >> r;
        Q.pb({t,{l,r}});
    }
    Sort(Q);
    for(int i=0;i<m;i++){
          //  for(int j=1;j<=n;j++) cout << A[j] << sep;
            //cout << endl;
        ll t=Q[i].F;
        ll l=(Q[i].S).F,r=(Q[i].S).S;
        if(t){
            for(int h=l+1;h<=r;h++){
                if(A[h]==1){
                    A[h]=A[h-1]+1;
                }

                else{
                    if(A[h]<A[h-1]){
                        A[h]=A[h-1];
                    }
                }
            }
        }
        else{
            if(A[r]>=A[l]) A[r]=A[l]-1;

        }
    }
    for(int i=0;i<m;i++){
        ll t=Q[i].F;
        ll l=(Q[i].S).F,r=(Q[i].S).S;
        if(t){
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    cout << "NO";
                    return 0;
                }
            }
        }
        else{
            bool f=0;
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    f=1;
                }
            }
            if(f==0){
                cout << "NO";
                return 0;
            }
        }
    }
    ll ttt=0;
    ll mini=INF;
    for(int i=1;i<=n;i++) mini=min(mini,A[i]);
    if(mini<1){
        ttt=1-mini;
    }
    cout << "YES" << endl;
    for(int i=1;i<=n;i++) cout << A[i]+ttt << sep;
    return 0;
}

/*!
NNNNNNNN        NNNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM                AAA
N;;;;;;;N       N;;;;;;N I::::::::I M;;;;;;;M             M;;;;;;;M               A:::A
N;;;;;;;;N      N;;;;;;N I::::::::I M;;;;;;;;M           M;;;;;;;;M              A\N.N/A
N;;;;;;;;;N     N;;;;;;N II::::::II M;;;;;;;;;M         M;;;;;;;;;M             A:::::::A
N;;;;;;;;;;N    N;;;;;;N   I::::I   M;;;;;;;;;;M       M;;;;;;;;;;M            A:::::::::A
N;;;;;;;;;;;N   N;;;;;;N   I::::I   M;;;;;;;;;;;M     M;;;;;;;;;;;M           A:::::A:::::A
N;;;;;;;N;;;;N  N;;;;;;N   I::::I   M:::::::M;;;;M   M;;;;M;;;;;;;M          A:::::A A:::::A
N;;;;;;N N;;;;N N;;;;;;N   I::::I   M;;;;;;M M;;;;M M;;;;M M;;;;;;M         A:::::A   A:::::A
N;;;;;;N  N;;;;N;;;;;;;N   I::::I   M;;;;;;M  M;;;;M;;;;M  M;;;;;;M        A:::::A     A:::::A
N;;;;;;N   N;;;;;;;;;;;N   I::::I   M;;;;;;M   M\\N.N//M   M;;;;;;M       A:::::AAAAAAAAA:::::A
N;;;;;;N    N;;;;;;;;;;N   I::::I   M;;;;;;M    M;;;;;M    M;;;;;;M      A:::In GOD we trust:::A
N;;;;;;N     N;;;;;;;;;N   I::::I   M;;;;;;M     MMMMM     M;;;;;;M     A:::::AAAAAAAAAAAAA:::::A
N;;;;;;N      N;;;;;;;;N II::::::II M;;;;;;M               M;;;;;;M    A:::::A             A:::::A
N;;;;;;N       N;;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M   A:::::A               A:::::A
N;;;;;;N        N;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M  A:::::A                 A:::::A
NNNNNNNN         NNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM AAAAAAA                   AAAAAAA
*/


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

typedef long long                   ll;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define F                           first
#define S                           second
#define sep                         ' '
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(x)                    cerr << "$$$ " << x << '\n';
#define error2(x,y)                 cerr << "#F : " << x << "      #S : " << y << '\n';
#define pb                          push_back

const ll MX5 = 3*1e5+3;
const ll MX6 = 1*1e6+37;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
const ll MOD2= 998244353;

ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
ll bmm(ll a,ll b){
    return (a%b==0 ? b : bmm(b,a%b));
}

ll A[MX5],n,m;
vector<pair<ll,pll> > Q;
int main(){
    fast_io
    //file_io
    cin >> n >> m;
    fill(A,A+n+3,1);
    for(int i=0;i<m;i++){
        ll t,l,r;
        cin >> t >> l >> r;
        Q.pb({t,{l,r}});
    }
    Sort(Q);
    for(int i=0;i<m;i++){
          //  for(int j=1;j<=n;j++) cout << A[j] << sep;
            //cout << endl;
        ll t=Q[i].F;
        ll l=(Q[i].S).F,r=(Q[i].S).S;
        if(t){
            for(int h=l+1;h<=r;h++){
                if(A[h]==1){
                    A[h]=A[h-1]+1;
                }

                else{
                    if(A[h]<A[h-1]){
                        A[h]=A[h-1];
                    }
                }
            }
        }
        else{
                bool f=0;
            for(int j=l;j<r;j++){
                if(A[j]<=A[j+1]){
                    ll GO;
                    //A[j+1]=A[j-1];
                }
                else{
                    f=1;
                }
            }
        if(f==0){
            for(int j=l;j<r;j++){
                if(A[j]<=A[j+1]){
                    A[j+1]=A[j-1];
                }
                else{
                    ll GO;
                }
            }
        }
        }
    }
    for(int i=0;i<m;i++){
        ll t=Q[i].F;
        ll l=(Q[i].S).F,r=(Q[i].S).S;
        if(t){
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    cout << "NO";
                    return 0;
                }
            }
        }
        else{
            bool f=0;
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    f=1;
                }
            }
            if(f==0){
                cout << "NO";
                return 0;
            }
        }
    }
    ll ttt=0;
    ll mini=INF;
    for(int i=1;i<=n;i++) mini=min(mini,A[i]);
    if(mini<1){
        ttt=1-mini;
    }
    cout << "YES" << endl;
    for(int i=1;i<=n;i++) cout << A[i]+ttt << sep;
    return 0;
}

/*!
NNNNNNNN        NNNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM                AAA
N;;;;;;;N       N;;;;;;N I::::::::I M;;;;;;;M             M;;;;;;;M               A:::A
N;;;;;;;;N      N;;;;;;N I::::::::I M;;;;;;;;M           M;;;;;;;;M              A\N.N/A
N;;;;;;;;;N     N;;;;;;N II::::::II M;;;;;;;;;M         M;;;;;;;;;M             A:::::::A
N;;;;;;;;;;N    N;;;;;;N   I::::I   M;;;;;;;;;;M       M;;;;;;;;;;M            A:::::::::A
N;;;;;;;;;;;N   N;;;;;;N   I::::I   M;;;;;;;;;;;M     M;;;;;;;;;;;M           A:::::A:::::A
N;;;;;;;N;;;;N  N;;;;;;N   I::::I   M:::::::M;;;;M   M;;;;M;;;;;;;M          A:::::A A:::::A
N;;;;;;N N;;;;N N;;;;;;N   I::::I   M;;;;;;M M;;;;M M;;;;M M;;;;;;M         A:::::A   A:::::A
N;;;;;;N  N;;;;N;;;;;;;N   I::::I   M;;;;;;M  M;;;;M;;;;M  M;;;;;;M        A:::::A     A:::::A
N;;;;;;N   N;;;;;;;;;;;N   I::::I   M;;;;;;M   M\\N.N//M   M;;;;;;M       A:::::AAAAAAAAA:::::A
N;;;;;;N    N;;;;;;;;;;N   I::::I   M;;;;;;M    M;;;;;M    M;;;;;;M      A:::In GOD we trust:::A
N;;;;;;N     N;;;;;;;;;N   I::::I   M;;;;;;M     MMMMM     M;;;;;;M     A:::::AAAAAAAAAAAAA:::::A
N;;;;;;N      N;;;;;;;;N II::::::II M;;;;;;M               M;;;;;;M    A:::::A             A:::::A
N;;;;;;N       N;;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M   A:::::A               A:::::A
N;;;;;;N        N;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M  A:::::A                 A:::::A
NNNNNNNN         NNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM AAAAAAA                   AAAAAAA
*/


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

typedef long long                   ll;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define F                           first
#define S                           second
#define sep                         ' '
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(x)                    cerr << "$$$ " << x << '\n';
#define error2(x,y)                 cerr << "#F : " << x << "      #S : " << y << '\n';
#define pb                          push_back

const ll MX5 = 3*1e5+3;
const ll MX6 = 1*1e6+37;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
const ll MOD2= 998244353;

ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
ll bmm(ll a,ll b){
    return (a%b==0 ? b : bmm(b,a%b));
}

ll A[MX5],n,m;
vector<pair<ll,pll> > Q;
int main(){
    fast_io
    //file_io
    cin >> n >> m;
    fill(A,A+n+3,1);
    for(int i=0;i<m;i++){
        ll t,l,r;
        cin >> t >> l >> r;
        Q.pb({!t,{l,r}});
    }
    Sort(Q);
    for(int i=0;i<m;i++){
          //  for(int j=1;j<=n;j++) cout << A[j] << sep;
            //cout << endl;
        ll t=!Q[i].F;
        ll l=(Q[i].S).F,r=(Q[i].S).S;
        if(t){
            for(int h=l+1;h<=r;h++){
                if(A[h]==1){
                    A[h]=A[h-1]+1;
                }

                else{
                    if(A[h]<A[h-1]){
                        A[h]=A[h-1];
                    }
                }
            }
        }
        else{
             bool f=0;
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    f=1;
                }
            }
            if(f==0){
                if(A[r]>=A[l]) A[r]=A[l]-1;
            }

        }
    }
    for(int i=0;i<m;i++){
        ll t=!Q[i].F;
        ll l=(Q[i].S).F,r=(Q[i].S).S;
        if(t){
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    cout << "NO";
                    return 0;
                }
            }
        }
        else{
            bool f=0;
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    f=1;
                }
            }
            if(f==0){
                cout << "NO";
                return 0;
            }
        }
    }
    ll ttt=0;
    ll mini=INF;
    for(int i=1;i<=n;i++) mini=min(mini,A[i]);
    if(mini<1){
        ttt=1-mini;
    }
    cout << "YES" << endl;
    for(int i=1;i<=n;i++) cout << A[i]+ttt << sep;
    return 0;
}

/*!
NNNNNNNN        NNNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM                AAA
N;;;;;;;N       N;;;;;;N I::::::::I M;;;;;;;M             M;;;;;;;M               A:::A
N;;;;;;;;N      N;;;;;;N I::::::::I M;;;;;;;;M           M;;;;;;;;M              A\N.N/A
N;;;;;;;;;N     N;;;;;;N II::::::II M;;;;;;;;;M         M;;;;;;;;;M             A:::::::A
N;;;;;;;;;;N    N;;;;;;N   I::::I   M;;;;;;;;;;M       M;;;;;;;;;;M            A:::::::::A
N;;;;;;;;;;;N   N;;;;;;N   I::::I   M;;;;;;;;;;;M     M;;;;;;;;;;;M           A:::::A:::::A
N;;;;;;;N;;;;N  N;;;;;;N   I::::I   M:::::::M;;;;M   M;;;;M;;;;;;;M          A:::::A A:::::A
N;;;;;;N N;;;;N N;;;;;;N   I::::I   M;;;;;;M M;;;;M M;;;;M M;;;;;;M         A:::::A   A:::::A
N;;;;;;N  N;;;;N;;;;;;;N   I::::I   M;;;;;;M  M;;;;M;;;;M  M;;;;;;M        A:::::A     A:::::A
N;;;;;;N   N;;;;;;;;;;;N   I::::I   M;;;;;;M   M\\N.N//M   M;;;;;;M       A:::::AAAAAAAAA:::::A
N;;;;;;N    N;;;;;;;;;;N   I::::I   M;;;;;;M    M;;;;;M    M;;;;;;M      A:::In GOD we trust:::A
N;;;;;;N     N;;;;;;;;;N   I::::I   M;;;;;;M     MMMMM     M;;;;;;M     A:::::AAAAAAAAAAAAA:::::A
N;;;;;;N      N;;;;;;;;N II::::::II M;;;;;;M               M;;;;;;M    A:::::A             A:::::A
N;;;;;;N       N;;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M   A:::::A               A:::::A
N;;;;;;N        N;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M  A:::::A                 A:::::A
NNNNNNNN         NNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM AAAAAAA                   AAAAAAA
*/


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

typedef long long                   ll;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define F                           first
#define S                           second
#define sep                         ' '
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(x)                    cerr << "$$$ " << x << '\n';
#define error2(x,y)                 cerr << "#F : " << x << "      #S : " << y << '\n';
#define pb                          push_back

const ll MX5 = 3*1e5+3;
const ll MX6 = 1*1e6+37;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
const ll MOD2= 998244353;

ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
ll bmm(ll a,ll b){
    return (a%b==0 ? b : bmm(b,a%b));
}

ll A[MX5],n,m;
vector<pair<ll,pll> > Q;
int main(){
    fast_io
    //file_io
    cin >> n >> m;
    fill(A,A+n+3,1);
    for(int i=0;i<m;i++){
        ll t,l,r;
        cin >> t >> l >> r;
        Q.pb({t,{l,r}});
    }
    Sort(Q);
    for(int i=0;i<m;i++){
            //for(int j=1;j<=n;j++) cout << A[j] << sep;
           //cout << endl;
        ll t=Q[i].F;
        ll l=(Q[i].S).F,r=(Q[i].S).S;
        error2(t,l);
        if(t){
            for(int h=l+1;h<=r;h++){

                    if(A[h]<A[h-1]){
                        A[h]=A[h-1];
                    }

            }
        }
        else{
                bool f=0;
            for(int j=l;j<r;j++){
                if(A[j]<=A[j+1]){
                    ll GO;
                    //A[j+1]=A[j-1];
                }
                else{
                    f=1;
                }
            }
            //error(f);
        if(f==0){
            for(int j=l;j<r;j++){
                if(A[j]<=A[j+1]){
                    A[j+1]=A[j-1]-1;
                }
                else{
                    ll GO;
                }
            }
        }
        }
    }
    for(int i=0;i<m;i++){
        ll t=Q[i].F;
        ll l=(Q[i].S).F,r=(Q[i].S).S;
        if(t){
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    cout << "NO";
                    return 0;
                }
            }
        }
        else{
            bool f=0;
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    f=1;
                }
            }
            if(f==0){
                cout << "NO";
                return 0;
            }
        }
    }
    ll ttt=0;
    ll mini=INF;
    for(int i=1;i<=n;i++) mini=min(mini,A[i]);
    if(mini<1){
        ttt=1-mini;
    }
    cout << "YES" << endl;
    for(int i=1;i<=n;i++) cout << A[i]+ttt << sep;
    return 0;
}

/*!
NNNNNNNN        NNNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM                AAA
N;;;;;;;N       N;;;;;;N I::::::::I M;;;;;;;M             M;;;;;;;M               A:::A
N;;;;;;;;N      N;;;;;;N I::::::::I M;;;;;;;;M           M;;;;;;;;M              A\N.N/A
N;;;;;;;;;N     N;;;;;;N II::::::II M;;;;;;;;;M         M;;;;;;;;;M             A:::::::A
N;;;;;;;;;;N    N;;;;;;N   I::::I   M;;;;;;;;;;M       M;;;;;;;;;;M            A:::::::::A
N;;;;;;;;;;;N   N;;;;;;N   I::::I   M;;;;;;;;;;;M     M;;;;;;;;;;;M           A:::::A:::::A
N;;;;;;;N;;;;N  N;;;;;;N   I::::I   M:::::::M;;;;M   M;;;;M;;;;;;;M          A:::::A A:::::A
N;;;;;;N N;;;;N N;;;;;;N   I::::I   M;;;;;;M M;;;;M M;;;;M M;;;;;;M         A:::::A   A:::::A
N;;;;;;N  N;;;;N;;;;;;;N   I::::I   M;;;;;;M  M;;;;M;;;;M  M;;;;;;M        A:::::A     A:::::A
N;;;;;;N   N;;;;;;;;;;;N   I::::I   M;;;;;;M   M\\N.N//M   M;;;;;;M       A:::::AAAAAAAAA:::::A
N;;;;;;N    N;;;;;;;;;;N   I::::I   M;;;;;;M    M;;;;;M    M;;;;;;M      A:::In GOD we trust:::A
N;;;;;;N     N;;;;;;;;;N   I::::I   M;;;;;;M     MMMMM     M;;;;;;M     A:::::AAAAAAAAAAAAA:::::A
N;;;;;;N      N;;;;;;;;N II::::::II M;;;;;;M               M;;;;;;M    A:::::A             A:::::A
N;;;;;;N       N;;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M   A:::::A               A:::::A
N;;;;;;N        N;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M  A:::::A                 A:::::A
NNNNNNNN         NNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM AAAAAAA                   AAAAAAA
*/


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

typedef long long                   ll;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define F                           first
#define S                           second
#define sep                         ' '
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(x)                    cerr << "$$$ " << x << '\n';
#define error2(x,y)                 cerr << "#F : " << x << "      #S : " << y << '\n';
#define pb                          push_back

const ll MX5 = 3*1e5+3;
const ll MX6 = 1*1e6+37;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
const ll MOD2= 998244353;

ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
ll bmm(ll a,ll b){
    return (a%b==0 ? b : bmm(b,a%b));
}

ll A[MX5],n,m;
vector<pair<pll,ll> > Q;
int main(){
    fast_io
    //file_io
    cin >> n >> m;
    fill(A,A+n+3,1);
    for(int i=0;i<m;i++){
        ll t,l,r;
        cin >> t >> l >> r;
        Q.pb({{l,r},t});
    }
    Sort(Q);
    for(int i=0;i<m;i++){
          //  for(int j=1;j<=n;j++) cout << A[j] << sep;
            //cout << endl;
        ll t=Q[i].S;
        ll l=(Q[i].F).F,r=(Q[i].F).S;
        if(t){
            for(int h=l+1;h<=r;h++){
                if(A[h]==1){
                    A[h]=A[h-1]+1;
                }

                else{
                    if(A[h]<A[h-1]){
                        A[h]=A[h-1];
                    }
                }
            }
        }
        else{
            if(A[r]>=A[l]) A[r]=A[l]-1;

        }
    }
    for(int i=0;i<m;i++){
        ll t=Q[i].S;
        ll l=(Q[i].F).F,r=(Q[i].F).S;
        if(t){
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    cout << "NO";
                    return 0;
                }
            }
        }
        else{
            bool f=0;
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    f=1;
                }
            }
            if(f==0){
                cout << "NO";
                return 0;
            }
        }
    }

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

/*!
NNNNNNNN        NNNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM                AAA
N;;;;;;;N       N;;;;;;N I::::::::I M;;;;;;;M             M;;;;;;;M               A:::A
N;;;;;;;;N      N;;;;;;N I::::::::I M;;;;;;;;M           M;;;;;;;;M              A\N.N/A
N;;;;;;;;;N     N;;;;;;N II::::::II M;;;;;;;;;M         M;;;;;;;;;M             A:::::::A
N;;;;;;;;;;N    N;;;;;;N   I::::I   M;;;;;;;;;;M       M;;;;;;;;;;M            A:::::::::A
N;;;;;;;;;;;N   N;;;;;;N   I::::I   M;;;;;;;;;;;M     M;;;;;;;;;;;M           A:::::A:::::A
N;;;;;;;N;;;;N  N;;;;;;N   I::::I   M:::::::M;;;;M   M;;;;M;;;;;;;M          A:::::A A:::::A
N;;;;;;N N;;;;N N;;;;;;N   I::::I   M;;;;;;M M;;;;M M;;;;M M;;;;;;M         A:::::A   A:::::A
N;;;;;;N  N;;;;N;;;;;;;N   I::::I   M;;;;;;M  M;;;;M;;;;M  M;;;;;;M        A:::::A     A:::::A
N;;;;;;N   N;;;;;;;;;;;N   I::::I   M;;;;;;M   M\\N.N//M   M;;;;;;M       A:::::AAAAAAAAA:::::A
N;;;;;;N    N;;;;;;;;;;N   I::::I   M;;;;;;M    M;;;;;M    M;;;;;;M      A:::In GOD we trust:::A
N;;;;;;N     N;;;;;;;;;N   I::::I   M;;;;;;M     MMMMM     M;;;;;;M     A:::::AAAAAAAAAAAAA:::::A
N;;;;;;N      N;;;;;;;;N II::::::II M;;;;;;M               M;;;;;;M    A:::::A             A:::::A
N;;;;;;N       N;;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M   A:::::A               A:::::A
N;;;;;;N        N;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M  A:::::A                 A:::::A
NNNNNNNN         NNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM AAAAAAA                   AAAAAAA
*/


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

typedef long long ll;
const ll MXN = 1e3 + 10;
ll n, m, l, r, t, a = 1;
ll A[MXN];
vector<pair<ll, ll>> vec;
bool mark[MXN];
int main(){
    ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for(int i = 0; i < m; i ++){
        cin >> t >> l >> r;
        if(!t) vec.emplace_back(l, r);
        else{
            for(int j = l + 1; j <= r; j ++) mark[j] = 1;
        }
    }
    for(auto[l, r] : vec){
        bool f = 0;
        for(int i = l; i <= r; i ++) if(!mark[i]) f = 1;
        if(!f) return cout << "NO", 0;
    }
    cout << "YES" << '\n';
    for(int i = n; i; i --) cout << (a = a + 1 - mark[i + 1]) << ' ';
    return 0;
}
/*!
    Be careful who you share your weaknesses with.
    Some people can't wait for the opportunity to use them against you!!
*/
//! N.N


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

typedef long long                   ll;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define F                           first
#define S                           second
#define sep                         ' '
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(x)                    cerr << "$$$ " << x << '\n';
#define error2(x,y)                 cerr << "#F : " << x << "      #S : " << y << '\n';
#define pb                          push_back

const ll MX5 = 3*1e5+3;
const ll MX6 = 1*1e6+37;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
const ll MOD2= 998244353;

ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
ll bmm(ll a,ll b){
    return (a%b==0 ? b : bmm(b,a%b));
}

ll A[MX5],n,m;
vector<pair<pll,ll> > Q;
int main(){
    fast_io
    //file_io
    cin >> n >> m;
    fill(A,A+n+3,1);
    for(int i=0;i<m;i++){
        ll t,l,r;
        cin >> t >> l >> r;
        Q.pb({{l,r},t});
    }
    Sort(Q);
    for(int i=0;i<m;i++){
          //  for(int j=1;j<=n;j++) cout << A[j] << sep;
            //cout << endl;
        ll t=Q[i].S;
        ll l=(Q[i].F).F,r=(Q[i].F).S;
        if(t){
            for(int h=l+1;h<=r;h++){
                if(A[h]==1){
                    A[h]=A[h-1]+1;
                }

                else{
                    if(A[h]<A[h-1]){
                        A[h]=A[h-1];
                    }
                }
            }
        }
        else{
            if(A[r]>=A[l]) A[r]=A[l]-1;

        }
    }
    for(int i=0;i<m;i++){
        ll t=Q[i].S;
        ll l=(Q[i].F).F,r=(Q[i].F).S;
        if(t){
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    cout << "NO";
                    return 0;
                }
            }
        }
        else{
            bool f=0;
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    f=1;
                }
            }
            if(f==0){
                cout << "NO";
                return 0;
            }
        }
    }
    ll ttt=0;
    ll mini=INF;
    for(int i=1;i<=n;i++) mini=min(mini,A[i]);
    if(mini<1){
        ttt=1-mini;
    }
    cout << "YES" << endl;
    for(int i=1;i<=n;i++) cout << A[i]+ttt << sep;
    return 0;
}

/*!
NNNNNNNN        NNNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM                AAA
N;;;;;;;N       N;;;;;;N I::::::::I M;;;;;;;M             M;;;;;;;M               A:::A
N;;;;;;;;N      N;;;;;;N I::::::::I M;;;;;;;;M           M;;;;;;;;M              A\N.N/A
N;;;;;;;;;N     N;;;;;;N II::::::II M;;;;;;;;;M         M;;;;;;;;;M             A:::::::A
N;;;;;;;;;;N    N;;;;;;N   I::::I   M;;;;;;;;;;M       M;;;;;;;;;;M            A:::::::::A
N;;;;;;;;;;;N   N;;;;;;N   I::::I   M;;;;;;;;;;;M     M;;;;;;;;;;;M           A:::::A:::::A
N;;;;;;;N;;;;N  N;;;;;;N   I::::I   M:::::::M;;;;M   M;;;;M;;;;;;;M          A:::::A A:::::A
N;;;;;;N N;;;;N N;;;;;;N   I::::I   M;;;;;;M M;;;;M M;;;;M M;;;;;;M         A:::::A   A:::::A
N;;;;;;N  N;;;;N;;;;;;;N   I::::I   M;;;;;;M  M;;;;M;;;;M  M;;;;;;M        A:::::A     A:::::A
N;;;;;;N   N;;;;;;;;;;;N   I::::I   M;;;;;;M   M\\N.N//M   M;;;;;;M       A:::::AAAAAAAAA:::::A
N;;;;;;N    N;;;;;;;;;;N   I::::I   M;;;;;;M    M;;;;;M    M;;;;;;M      A:::In GOD we trust:::A
N;;;;;;N     N;;;;;;;;;N   I::::I   M;;;;;;M     MMMMM     M;;;;;;M     A:::::AAAAAAAAAAAAA:::::A
N;;;;;;N      N;;;;;;;;N II::::::II M;;;;;;M               M;;;;;;M    A:::::A             A:::::A
N;;;;;;N       N;;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M   A:::::A               A:::::A
N;;;;;;N        N;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M  A:::::A                 A:::::A
NNNNNNNN         NNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM AAAAAAA                   AAAAAAA
*/


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

typedef long long ll;
const ll MXN = 1e3 + 10;
ll n, m, l, r, t, a = 1;
ll A[MXN];
vector<pair<ll, ll>> vec;
vector<ll> Ans;
bool mark[MXN];
int main(){
    ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for(int i = 0; i < m; i ++){
        cin >> t >> l >> r;
        if(!t) vec.emplace_back(l, r);
        else{
            for(int j = l + 1; j <= r; j ++) mark[j] = 1;
        }
    }
    for(auto[l, r] : vec){
        bool f = 0;
        for(int i = l; i <= r; i ++) if(!mark[i]) f = 1;
        if(!f) return cout << "NO", 0;
    }
    cout << "YES" << '\n';
    for(int i = n; i; i --) Ans.push_back(a = a + 1 - mark[i + 1]);
    reverse(Ans.begin(), Ans.end());
    for(auto X : Ans) cout << X << ' ';
    return 0;
}
/*!
    Be careful who you share your weaknesses with.
    Some people can't wait for the opportunity to use them against you!!
*/
//! N.N


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

typedef long long                   ll;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define F                           first
#define S                           second
#define sep                         ' '
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(x)                    cerr << "$$$ " << x << '\n';
#define error2(x,y)                 cerr << "#F : " << x << "      #S : " << y << '\n';
#define pb                          push_back

const ll MX5 = 3*1e5+3;
const ll MX6 = 1*1e6+37;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
const ll MOD2= 998244353;

ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
ll bmm(ll a,ll b){
    return (a%b==0 ? b : bmm(b,a%b));
}

ll A[MX5],n,m;
vector<pair<ll,pll> > Q;
int main(){
    fast_io
    //file_io
    cin >> n >> m;
    fill(A,A+n+3,1);
    for(int i=0;i<m;i++){
        ll t,l,r;
        cin >> t >> l >> r;
        Q.pb({t,{l,r}});
    }
    Sort(Q);
    for(int i=0;i<m;i++){
          //  for(int j=1;j<=n;j++) cout << A[j] << sep;
            //cout << endl;
        ll t=Q[i].F;
        ll l=(Q[i].S).F,r=(Q[i].S).S;
        if(t){
            for(int h=l+1;h<=r;h++){
                if(A[h]==1){
                    A[h]=A[h-1]+1;
                }

                else{
                    if(A[h]<A[h-1]){
                        A[h]=A[h-1];
                    }
                }
            }
        }
        else{
            for(int j=l;j<r;j++){
                if(A[j]<=A[j+1]){
                    A[j+1]=A[j-1];
                }
            }
        }
    }
    for(int i=0;i<m;i++){
        ll t=Q[i].F;
        ll l=(Q[i].S).F,r=(Q[i].S).S;
        if(t){
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    cout << "NO";
                    return 0;
                }
            }
        }
        else{
            bool f=0;
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    f=1;
                }
            }
            if(f==0){
                cout << "NO";
                return 0;
            }
        }
    }
    ll ttt=0;
    ll mini=INF;
    for(int i=1;i<=n;i++) mini=min(mini,A[i]);
    if(mini<1){
        ttt=1-mini;
    }
    cout << "YES" << endl;
    for(int i=1;i<=n;i++) cout << A[i]+ttt << sep;
    return 0;
}

/*!
NNNNNNNN        NNNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM                AAA
N;;;;;;;N       N;;;;;;N I::::::::I M;;;;;;;M             M;;;;;;;M               A:::A
N;;;;;;;;N      N;;;;;;N I::::::::I M;;;;;;;;M           M;;;;;;;;M              A\N.N/A
N;;;;;;;;;N     N;;;;;;N II::::::II M;;;;;;;;;M         M;;;;;;;;;M             A:::::::A
N;;;;;;;;;;N    N;;;;;;N   I::::I   M;;;;;;;;;;M       M;;;;;;;;;;M            A:::::::::A
N;;;;;;;;;;;N   N;;;;;;N   I::::I   M;;;;;;;;;;;M     M;;;;;;;;;;;M           A:::::A:::::A
N;;;;;;;N;;;;N  N;;;;;;N   I::::I   M:::::::M;;;;M   M;;;;M;;;;;;;M          A:::::A A:::::A
N;;;;;;N N;;;;N N;;;;;;N   I::::I   M;;;;;;M M;;;;M M;;;;M M;;;;;;M         A:::::A   A:::::A
N;;;;;;N  N;;;;N;;;;;;;N   I::::I   M;;;;;;M  M;;;;M;;;;M  M;;;;;;M        A:::::A     A:::::A
N;;;;;;N   N;;;;;;;;;;;N   I::::I   M;;;;;;M   M\\N.N//M   M;;;;;;M       A:::::AAAAAAAAA:::::A
N;;;;;;N    N;;;;;;;;;;N   I::::I   M;;;;;;M    M;;;;;M    M;;;;;;M      A:::In GOD we trust:::A
N;;;;;;N     N;;;;;;;;;N   I::::I   M;;;;;;M     MMMMM     M;;;;;;M     A:::::AAAAAAAAAAAAA:::::A
N;;;;;;N      N;;;;;;;;N II::::::II M;;;;;;M               M;;;;;;M    A:::::A             A:::::A
N;;;;;;N       N;;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M   A:::::A               A:::::A
N;;;;;;N        N;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M  A:::::A                 A:::::A
NNNNNNNN         NNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM AAAAAAA                   AAAAAAA
*/


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

typedef long long                   ll;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define F                           first
#define S                           second
#define sep                         ' '
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(x)                    cerr << "$$$ " << x << '\n';
#define error2(x,y)                 cerr << "#F : " << x << "      #S : " << y << '\n';
#define pb                          push_back

const ll MX5 = 3*1e5+3;
const ll MX6 = 1*1e6+37;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
const ll MOD2= 998244353;

ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
ll bmm(ll a,ll b){
    return (a%b==0 ? b : bmm(b,a%b));
}

ll A[MX5],n,m;
vector<pair<ll,pll> > Q;
int main(){
    fast_io
    //file_io
    cin >> n >> m;
    fill(A,A+n+3,1);
    for(int i=0;i<m;i++){
        ll t,l,r;
        cin >> t >> l >> r;
        Q.pb({t,{l,r}});
    }
    Sort(Q);
    for(int i=0;i<m;i++){
          //  for(int j=1;j<=n;j++) cout << A[j] << sep;
            //cout << endl;
        ll t=Q[i].F;
        ll l=(Q[i].S).F,r=(Q[i].S).S;
        if(t){
            for(int h=l+1;h<=r;h++){

                    if(A[h]<A[h-1]){
                        A[h]=A[h-1];
                    }

            }
        }
        else{
                bool f=0;
            for(int j=l;j<r;j++){
                if(A[j]<=A[j+1]){
                    ll GO;
                    //A[j+1]=A[j-1];
                }
                else{
                    f=1;
                }
            }
        if(f==0){
            for(int j=l;j<r;j++){
                if(A[j]<=A[j+1]){
                    A[j+1]=A[j-1];
                }
                else{
                    ll GO;
                }
            }
        }
        }
    }
    for(int i=0;i<m;i++){
        ll t=Q[i].F;
        ll l=(Q[i].S).F,r=(Q[i].S).S;
        if(t){
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    cout << "NO";
                    return 0;
                }
            }
        }
        else{
            bool f=0;
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    f=1;
                }
            }
            if(f==0){
                cout << "NO";
                return 0;
            }
        }
    }
    ll ttt=0;
    ll mini=INF;
    for(int i=1;i<=n;i++) mini=min(mini,A[i]);
    if(mini<1){
        ttt=1-mini;
    }
    cout << "YES" << endl;
    for(int i=1;i<=n;i++) cout << A[i]+ttt << sep;
    return 0;
}

/*!
NNNNNNNN        NNNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM                AAA
N;;;;;;;N       N;;;;;;N I::::::::I M;;;;;;;M             M;;;;;;;M               A:::A
N;;;;;;;;N      N;;;;;;N I::::::::I M;;;;;;;;M           M;;;;;;;;M              A\N.N/A
N;;;;;;;;;N     N;;;;;;N II::::::II M;;;;;;;;;M         M;;;;;;;;;M             A:::::::A
N;;;;;;;;;;N    N;;;;;;N   I::::I   M;;;;;;;;;;M       M;;;;;;;;;;M            A:::::::::A
N;;;;;;;;;;;N   N;;;;;;N   I::::I   M;;;;;;;;;;;M     M;;;;;;;;;;;M           A:::::A:::::A
N;;;;;;;N;;;;N  N;;;;;;N   I::::I   M:::::::M;;;;M   M;;;;M;;;;;;;M          A:::::A A:::::A
N;;;;;;N N;;;;N N;;;;;;N   I::::I   M;;;;;;M M;;;;M M;;;;M M;;;;;;M         A:::::A   A:::::A
N;;;;;;N  N;;;;N;;;;;;;N   I::::I   M;;;;;;M  M;;;;M;;;;M  M;;;;;;M        A:::::A     A:::::A
N;;;;;;N   N;;;;;;;;;;;N   I::::I   M;;;;;;M   M\\N.N//M   M;;;;;;M       A:::::AAAAAAAAA:::::A
N;;;;;;N    N;;;;;;;;;;N   I::::I   M;;;;;;M    M;;;;;M    M;;;;;;M      A:::In GOD we trust:::A
N;;;;;;N     N;;;;;;;;;N   I::::I   M;;;;;;M     MMMMM     M;;;;;;M     A:::::AAAAAAAAAAAAA:::::A
N;;;;;;N      N;;;;;;;;N II::::::II M;;;;;;M               M;;;;;;M    A:::::A             A:::::A
N;;;;;;N       N;;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M   A:::::A               A:::::A
N;;;;;;N        N;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M  A:::::A                 A:::::A
NNNNNNNN         NNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM AAAAAAA                   AAAAAAA
*/


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

typedef long long                   ll;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define F                           first
#define S                           second
#define sep                         ' '
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(x)                    cerr << "$$$ " << x << '\n';
#define error2(x,y)                 cerr << "#F : " << x << "      #S : " << y << '\n';
#define pb                          push_back

const ll MX5 = 3*1e5+3;
const ll MX6 = 1*1e6+37;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
const ll MOD2= 998244353;

ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
ll bmm(ll a,ll b){
    return (a%b==0 ? b : bmm(b,a%b));
}

ll A[MX5],n,m;
vector<pair<pll,ll> > Q;
int main(){
    fast_io
    //file_io
    cin >> n >> m;
    fill(A,A+n+3,1);
    for(int i=0;i<m;i++){
        ll t,l,r;
        cin >> t >> l >> r;
        Q.pb({{l,r},t});
    }
    Sort(Q);
    for(int i=0;i<m;i++){
          //  for(int j=1;j<=n;j++) cout << A[j] << sep;
            //cout << endl;
        ll t=Q[i].S;
        ll l=(Q[i].F).F,r=(Q[i].F).S;
        if(t){
            for(int h=l+1;h<=r;h++){
                if(A[h]==1){
                    A[h]=A[h-1]+1;
                }

                else{
                    if(A[h]<A[h-1]){
                        A[h]=A[h-1];
                    }
                }
            }
        }
        else{
            if(A[r]>=A[l]) A[r]=A[l]-1;

        }
    }
    for(int i=0;i<m;i++){
        ll t=Q[i].S;
        ll l=(Q[i].F).F,r=(Q[i].F).S;
        if(t){
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    cout << "NO";
                    return 0;
                }
            }
        }
        else{
            bool f=0;
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    f=1;
                }
            }
            if(f==0){
                cout << "NO";
                return 0;
            }
        }
    }
    cout << "YES" << endl;
    for(int i=1;i<=n;i++) cout << A[i] << sep;
    return 0;
}

/*!
NNNNNNNN        NNNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM                AAA
N;;;;;;;N       N;;;;;;N I::::::::I M;;;;;;;M             M;;;;;;;M               A:::A
N;;;;;;;;N      N;;;;;;N I::::::::I M;;;;;;;;M           M;;;;;;;;M              A\N.N/A
N;;;;;;;;;N     N;;;;;;N II::::::II M;;;;;;;;;M         M;;;;;;;;;M             A:::::::A
N;;;;;;;;;;N    N;;;;;;N   I::::I   M;;;;;;;;;;M       M;;;;;;;;;;M            A:::::::::A
N;;;;;;;;;;;N   N;;;;;;N   I::::I   M;;;;;;;;;;;M     M;;;;;;;;;;;M           A:::::A:::::A
N;;;;;;;N;;;;N  N;;;;;;N   I::::I   M:::::::M;;;;M   M;;;;M;;;;;;;M          A:::::A A:::::A
N;;;;;;N N;;;;N N;;;;;;N   I::::I   M;;;;;;M M;;;;M M;;;;M M;;;;;;M         A:::::A   A:::::A
N;;;;;;N  N;;;;N;;;;;;;N   I::::I   M;;;;;;M  M;;;;M;;;;M  M;;;;;;M        A:::::A     A:::::A
N;;;;;;N   N;;;;;;;;;;;N   I::::I   M;;;;;;M   M\\N.N//M   M;;;;;;M       A:::::AAAAAAAAA:::::A
N;;;;;;N    N;;;;;;;;;;N   I::::I   M;;;;;;M    M;;;;;M    M;;;;;;M      A:::In GOD we trust:::A
N;;;;;;N     N;;;;;;;;;N   I::::I   M;;;;;;M     MMMMM     M;;;;;;M     A:::::AAAAAAAAAAAAA:::::A
N;;;;;;N      N;;;;;;;;N II::::::II M;;;;;;M               M;;;;;;M    A:::::A             A:::::A
N;;;;;;N       N;;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M   A:::::A               A:::::A
N;;;;;;N        N;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M  A:::::A                 A:::::A
NNNNNNNN         NNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM AAAAAAA                   AAAAAAA
*/


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

typedef long long                   ll;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define F                           first
#define S                           second
#define sep                         ' '
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(x)                    cerr << "$$$ " << x << '\n';
#define error2(x,y)                 cerr << "#F : " << x << "      #S : " << y << '\n';
#define pb                          push_back

const ll MX5 = 3*1e5+3;
const ll MX6 = 1*1e6+37;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
const ll MOD2= 998244353;

ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
ll bmm(ll a,ll b){
    return (a%b==0 ? b : bmm(b,a%b));
}

ll A[MX5],n,m;
vector<pair<pll,ll> > Q;
int main(){
    fast_io
    //file_io
    cin >> n >> m;
    fill(A,A+n+3,1);
    for(int i=0;i<m;i++){
        ll t,l,r;
        cin >> t >> l >> r;
        Q.pb({{l,r},t});
    }
    Sort(Q);
    for(int i=0;i<m;i++){
          //  for(int j=1;j<=n;j++) cout << A[j] << sep;
            //cout << endl;
        ll t=Q[i].S;
        ll l=(Q[i].F).F,r=(Q[i].F).S;
        if(t){
            for(int h=l+1;h<=r;h++){
                if(A[h]==1){
                    A[h]=A[h-1]+1;
                }

                else{
                    if(A[h]<A[h-1]){
                        A[h]=A[h-1];
                    }
                }
            }
        }
        else{
             bool f=0;
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    f=1;
                }
            }
            if(f==0){
                if(A[r]>=A[l]) A[r]=A[l]-1;
            }

        }
    }
    for(int i=0;i<m;i++){
        ll t=Q[i].S;
        ll l=(Q[i].F).F,r=(Q[i].F).S;
        if(t){
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    cout << "NO";
                    return 0;
                }
            }
        }
        else{
            bool f=0;
            for(int j=l;j<r;j++){
                if(A[j]>A[j+1]){
                    f=1;
                }
            }
            if(f==0){
                cout << "NO";
                return 0;
            }
        }
    }
    ll ttt=0;
    ll mini=INF;
    for(int i=1;i<=n;i++) mini=min(mini,A[i]);
    if(mini<1){
        ttt=1-mini;
    }
    cout << "YES" << endl;
    for(int i=1;i<=n;i++) cout << A[i]+ttt << sep;
    return 0;
}

/*!
NNNNNNNN        NNNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM                AAA
N;;;;;;;N       N;;;;;;N I::::::::I M;;;;;;;M             M;;;;;;;M               A:::A
N;;;;;;;;N      N;;;;;;N I::::::::I M;;;;;;;;M           M;;;;;;;;M              A\N.N/A
N;;;;;;;;;N     N;;;;;;N II::::::II M;;;;;;;;;M         M;;;;;;;;;M             A:::::::A
N;;;;;;;;;;N    N;;;;;;N   I::::I   M;;;;;;;;;;M       M;;;;;;;;;;M            A:::::::::A
N;;;;;;;;;;;N   N;;;;;;N   I::::I   M;;;;;;;;;;;M     M;;;;;;;;;;;M           A:::::A:::::A
N;;;;;;;N;;;;N  N;;;;;;N   I::::I   M:::::::M;;;;M   M;;;;M;;;;;;;M          A:::::A A:::::A
N;;;;;;N N;;;;N N;;;;;;N   I::::I   M;;;;;;M M;;;;M M;;;;M M;;;;;;M         A:::::A   A:::::A
N;;;;;;N  N;;;;N;;;;;;;N   I::::I   M;;;;;;M  M;;;;M;;;;M  M;;;;;;M        A:::::A     A:::::A
N;;;;;;N   N;;;;;;;;;;;N   I::::I   M;;;;;;M   M\\N.N//M   M;;;;;;M       A:::::AAAAAAAAA:::::A
N;;;;;;N    N;;;;;;;;;;N   I::::I   M;;;;;;M    M;;;;;M    M;;;;;;M      A:::In GOD we trust:::A
N;;;;;;N     N;;;;;;;;;N   I::::I   M;;;;;;M     MMMMM     M;;;;;;M     A:::::AAAAAAAAAAAAA:::::A
N;;;;;;N      N;;;;;;;;N II::::::II M;;;;;;M               M;;;;;;M    A:::::A             A:::::A
N;;;;;;N       N;;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M   A:::::A               A:::::A
N;;;;;;N        N;;;;;;N I::::::::I M;;;;;;M               M;;;;;;M  A:::::A                 A:::::A
NNNNNNNN         NNNNNNN IIIIIIIIII MMMMMMMM               MMMMMMMM AAAAAAA                   AAAAAAA
*/