func_code_string: #include <bits/stdc++.h>   using namespace std;   int num = 1001;   struct node {     long long l, r;     int t;   } a[1008611];   long long ans[1008611], tm[1008611];   int main() {     long long n, m;     cin >> n >> m;     for (long long i = 0; i < m; i++) {       cin >> a[i].t >> a[i].l >> a[i].r;       if (a[i].t) {         for (long long k = a[i].l; k < a[i].r; k++) {           tm[k] = 1;         }       }     }     ans[1] = num;     for (long long i = 2; i <= n; i++) {       if (tm[i - 1] == 0) num--;       ans[i] = num;     }     for (long long j = 0; j < m; j++) {       int pos = 1;       for (long long k = a[j].l; k < a[j].r; k++) {         if (ans[k] > ans[k + 1]) {           pos = 0;           break;         }       }       if (pos != a[j].t) {         cout <<  NO  << endl;         return 0;       }     }     cout <<  YES  << endl;     for (int i = 1; i <= n; i++) cout << ans[i] <<    ;     return 0;   }   