func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 3e5 + 1;   vector<int> s[N], e[N];   int n, m, l[N], r[N], x[N], res[N];   bool vis[N];   int main() {     scanf( %d%d , &n, &m);     for (int i = 0; i < m; ++i) {       scanf( %d%d%d , &l[i], &r[i], &x[i]);       s[l[i]].push_back(i);       e[r[i]].push_back(i);     }     priority_queue<int> qu;     vector<int> w;     for (int i = 1; i <= n; ++i) {       for (size_t j = 0; j < s[i].size(); ++j) qu.push(-s[i][j]);       bool can = false;       while (!qu.empty()) {         int v = -qu.top();         if (!vis[v]) {           can = true;           break;         }         qu.pop();       }       if (!can) continue;       w.clear();       while (!qu.empty()) {         int v = -qu.top();         if (x[v] == i || i < l[v] || i > r[v]) {           qu.pop();           w.push_back(v);           continue;         }         res[i] = x[v];         break;       }       for (size_t j = 0; j < w.size(); ++j) qu.push(-w[j]);       for (size_t j = 0; j < e[i].size(); ++j) vis[e[i][j]] = true;     }     for (int i = 1; i <= n; ++i) printf( %s%d , i > 1 ?     :   , res[i]);     puts(  );     return 0;   }   