func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 300050;   int a[maxn << 2];   int ll[maxn], rr[maxn], x[maxn], N, M;   void getdown(int cur) {     a[cur << 1] = a[cur];     a[(cur << 1) | 1] = a[cur];     a[cur] = 0;   }   void Insert(int cur, int L, int R, int l, int r, int u) {     int mid = (L + R) >> 1;     if (l <= L && R <= r) {       a[cur] = u;       return;     }     if (a[cur]) getdown(cur);     if (l <= mid) Insert(((cur) << 1), L, mid, l, r, u);     if (r > mid) Insert((((cur) << 1) | 1), (mid + 1), R, l, r, u);   }   int Query(int cur, int L, int R, int p) {     int mid = (L + R) >> 1;     if (a[cur]) return a[cur];     if (L == R) return a[cur];     if (p <= mid)       return Query(((cur) << 1), L, mid, p);     else       return Query((((cur) << 1) | 1), (mid + 1), R, p);   }   int main() {     scanf( %d%d , &N, &M);     for (int i = 1; i <= M; i++) {       scanf( %d%d%d , &ll[i], &rr[i], &x[i]);     }     for (int i = M; i >= 1; i--) {       if (ll[i] < x[i]) Insert(1, 1, N, ll[i], x[i] - 1, x[i]);       if (x[i] < rr[i]) Insert(1, 1, N, x[i] + 1, rr[i], x[i]);     }     printf( %d , Query(1, 1, N, 1));     for (int i = 2; i <= N; i++) printf(  %d , Query(1, 1, N, i));     printf(  n );     return 0;   }   