#include <bits/stdc++.h>   using namespace std;   set<int> s;   int ans[300005];   int main() {     int n, m, l, r, x;     cin >> n >> m;     for (int i = 1; i < n + 1; i++) {       s.insert(i);       ans[i] = 0;     }     for (int i = 0; i < m; i++) {       cin >> l >> r >> x;       set<int>::iterator lb = s.lower_bound(l), ub = s.upper_bound(r);       for (set<int>::iterator it = lb; it != ub; it++)         if (*it != x) ans[*it] = x;       s.erase(lb, ub);       s.insert(x);     }     for (int i = 1; i < n + 1; i++) cout << ans[i] <<    ;     cout <<   n ;     return 0;   }   