#include <stdio.h>
#include <algorithm>
#include <map>
using namespace std;
int n;
int type[300005], a[300005], b[300005], c[300005];
int res[300005];
map<int, int> occ;
// Segment Tree 1
int t[600005];
int findmax(int p){
int res=2e9;
for (p+=n; p; p>>=1) res = min(res, t[p]);
return res;
}
void upd(int l, int r, int x){
for(l+=n, r+=n; l<r; l>>=1, r>>=1){
if(l&1) t[l] = min(t[l], x), l++;
if(r&1) r--, t[r] = min(t[r], x);
}
return;
}
// Segment Tree 2
int t2[600005];
int findmax(int l, int r){
int res = -2e9;
for(l+=n, r+=n; l<r; l>>=1, r>>=1){
if(l&1) res = max(res, t2[l++]);
if(r&1) res = max(res, t2[--r]);
}
return res;
}
void updval(int p, int val){
for(t2[p+=n]=val; p>1; p>>=1) t2[p>>1] = max(t2[p], t2[p^1]);
return;
}
// Main Solution
int main(){
int m;
scanf("%d%d", &n, &m);
for(int i=0; i<2*n; i++) t[i] = 2e9;
for(int i=0; i<n; i++) res[i] = (2e9)+1;
for(int i=0; i<m; i++){
scanf("%d", &type[i]);
if(type[i] == 1){
scanf("%d%d%d", &a[i], &b[i], &c[i]);
a[i]--, b[i]--;
upd(a[i], b[i]+1, c[i]);
} else{
scanf("%d%d", &a[i], &b[i]);
a[i]--;
if(res[a[i]] == (2e9)+1) res[a[i]] = findmax(a[i]);
}
}
for(int i=0; i<n; i++) if(res[i] == (2e9)+1) res[i] = findmax(i);
// Check validity of the array
for(int i=0; i<n; i++) t2[n+i] = res[i];
for(int i=n-1; i>0; i--) t2[i] = max(t2[i<<1], t2[i<<1|1]);
for(int i=0; i<m; i++){
if(type[i] == 1){
if(findmax(a[i], b[i]+1) != c[i]){ printf("NO"); return 0; }
} else{
updval(a[i], b[i]);
}
}
for(int i=0; i<n; i++) if(res[i] < 0){ printf("NO"); return 0; }
// Make the answer optimal
printf("YES\n");
for(int i=0; i<n; i++) occ[res[i]]++;
// - occ[2e9] >= 2 then the optimal OR result can simply be (1<<30)-1
if(occ[2e9] >= 2){
for(int i=0; i<n; i++) if(res[i] == 2e9){
res[i] = 1e9, occ[2e9]--;
if(occ[2e9] == 0) res[i] = (1<<29)-1;
}
for(int i=0; i<n; i++) printf("%d ", res[i]);
return 0;
}
// - otherwise, find the best value for the free 2e9 (if any)
int orresult = 0;
for(int i=0; i<n; i++){
if(res[i] == 0 || res[i] == 2e9) continue; // ignoring this could lead to a critical bug
occ[res[i]]--;
if(occ[res[i]]){
int temp=res[i], pow=0;
while(temp) pow++, temp /= 2;
res[i] = (1<<(pow-1))-1;
}
orresult |= res[i];
}
int tobe=0;
for(int cur=29; cur>=0; cur--){
if(orresult&(1<<cur)) continue;
if(tobe+(1<<cur) > 1e9) continue;
tobe += (1<<cur);
}
for(int i=0; i<n; i++){
if(res[i] == 2e9) printf("%d ", tobe);
else printf("%d ", res[i]);
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxhbGdvcml0aG0+CiNpbmNsdWRlIDxtYXA+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbjsKaW50IHR5cGVbMzAwMDA1XSwgYVszMDAwMDVdLCBiWzMwMDAwNV0sIGNbMzAwMDA1XTsKaW50IHJlc1szMDAwMDVdOwptYXA8aW50LCBpbnQ+IG9jYzsKCi8vIFNlZ21lbnQgVHJlZSAxCgppbnQgdFs2MDAwMDVdOwoKaW50IGZpbmRtYXgoaW50IHApewogICAgaW50IHJlcz0yZTk7CiAgICBmb3IgKHArPW47IHA7IHA+Pj0xKSByZXMgPSBtaW4ocmVzLCB0W3BdKTsKICAgIHJldHVybiByZXM7Cn0KCnZvaWQgdXBkKGludCBsLCBpbnQgciwgaW50IHgpewogICAgZm9yKGwrPW4sIHIrPW47IGw8cjsgbD4+PTEsIHI+Pj0xKXsKICAgICAgICBpZihsJjEpIHRbbF0gPSBtaW4odFtsXSwgeCksIGwrKzsKICAgICAgICBpZihyJjEpIHItLSwgdFtyXSA9IG1pbih0W3JdLCB4KTsKICAgIH0KICAgIHJldHVybjsKfQoKLy8gU2VnbWVudCBUcmVlIDIKCmludCB0Mls2MDAwMDVdOwoKaW50IGZpbmRtYXgoaW50IGwsIGludCByKXsKICAgIGludCByZXMgPSAtMmU5OwogICAgZm9yKGwrPW4sIHIrPW47IGw8cjsgbD4+PTEsIHI+Pj0xKXsKICAgICAgICBpZihsJjEpIHJlcyA9IG1heChyZXMsIHQyW2wrK10pOwogICAgICAgIGlmKHImMSkgcmVzID0gbWF4KHJlcywgdDJbLS1yXSk7CiAgICB9CiAgICByZXR1cm4gcmVzOwp9Cgp2b2lkIHVwZHZhbChpbnQgcCwgaW50IHZhbCl7CiAgICBmb3IodDJbcCs9bl09dmFsOyBwPjE7IHA+Pj0xKSB0MltwPj4xXSA9IG1heCh0MltwXSwgdDJbcF4xXSk7CiAgICByZXR1cm47Cn0KCi8vIE1haW4gU29sdXRpb24KCmludCBtYWluKCl7CiAgICBpbnQgbTsKICAgIHNjYW5mKCIlZCVkIiwgJm4sICZtKTsKICAgIGZvcihpbnQgaT0wOyBpPDIqbjsgaSsrKSB0W2ldID0gMmU5OwogICAgZm9yKGludCBpPTA7IGk8bjsgaSsrKSByZXNbaV0gPSAoMmU5KSsxOwogICAgZm9yKGludCBpPTA7IGk8bTsgaSsrKXsKICAgICAgICBzY2FuZigiJWQiLCAmdHlwZVtpXSk7CiAgICAgICAgaWYodHlwZVtpXSA9PSAxKXsKICAgICAgICAgICAgc2NhbmYoIiVkJWQlZCIsICZhW2ldLCAmYltpXSwgJmNbaV0pOwogICAgICAgICAgICBhW2ldLS0sIGJbaV0tLTsKICAgICAgICAgICAgdXBkKGFbaV0sIGJbaV0rMSwgY1tpXSk7CiAgICAgICAgfSBlbHNlewogICAgICAgICAgICBzY2FuZigiJWQlZCIsICZhW2ldLCAmYltpXSk7CiAgICAgICAgICAgIGFbaV0tLTsKICAgICAgICAgICAgaWYocmVzW2FbaV1dID09ICgyZTkpKzEpIHJlc1thW2ldXSA9IGZpbmRtYXgoYVtpXSk7CiAgICAgICAgfQogICAgfQogICAgZm9yKGludCBpPTA7IGk8bjsgaSsrKSBpZihyZXNbaV0gPT0gKDJlOSkrMSkgcmVzW2ldID0gZmluZG1heChpKTsKICAgIAogICAgLy8gQ2hlY2sgdmFsaWRpdHkgb2YgdGhlIGFycmF5CiAgICBmb3IoaW50IGk9MDsgaTxuOyBpKyspIHQyW24raV0gPSByZXNbaV07CiAgICBmb3IoaW50IGk9bi0xOyBpPjA7IGktLSkgdDJbaV0gPSBtYXgodDJbaTw8MV0sIHQyW2k8PDF8MV0pOwogICAgZm9yKGludCBpPTA7IGk8bTsgaSsrKXsKICAgICAgICBpZih0eXBlW2ldID09IDEpewogICAgICAgICAgICBpZihmaW5kbWF4KGFbaV0sIGJbaV0rMSkgIT0gY1tpXSl7IHByaW50ZigiTk8iKTsgcmV0dXJuIDA7IH0KICAgICAgICB9IGVsc2V7CiAgICAgICAgICAgIHVwZHZhbChhW2ldLCBiW2ldKTsKICAgICAgICB9CiAgICB9CiAgICBmb3IoaW50IGk9MDsgaTxuOyBpKyspIGlmKHJlc1tpXSA8IDApeyBwcmludGYoIk5PIik7IHJldHVybiAwOyB9CiAgICAKICAgIC8vIE1ha2UgdGhlIGFuc3dlciBvcHRpbWFsCiAgICBwcmludGYoIllFU1xuIik7CiAgICBmb3IoaW50IGk9MDsgaTxuOyBpKyspIG9jY1tyZXNbaV1dKys7CiAgICAvLyAtIG9jY1syZTldID49IDIgdGhlbiB0aGUgb3B0aW1hbCBPUiByZXN1bHQgY2FuIHNpbXBseSBiZSAoMTw8MzApLTEKICAgIGlmKG9jY1syZTldID49IDIpewogICAgICAgIGZvcihpbnQgaT0wOyBpPG47IGkrKykgaWYocmVzW2ldID09IDJlOSl7CiAgICAgICAgICAgIHJlc1tpXSA9IDFlOSwgb2NjWzJlOV0tLTsKICAgICAgICAgICAgaWYob2NjWzJlOV0gPT0gMCkgcmVzW2ldID0gKDE8PDI5KS0xOwogICAgICAgIH0KICAgICAgICBmb3IoaW50IGk9MDsgaTxuO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