#include <bits/stdc++.h>   using namespace std;   template <typename T, typename T1>   T amax(T &a, T1 b) {     if (b > a) a = b;     return a;   }   template <typename T, typename T1>   T amin(T &a, T1 b) {     if (b < a) a = b;     return a;   }   bool isPrime(long long x) {     if (x == 1) return false;     for (long long i = 2; i * i <= x; i++) {       if (x % i == 0) {         return false;       }     }     return true;   }   bool isPowerOfTwo(long long n) {     if (n == 0) return false;     return (ceil(log2(n)) == floor(log2(n)));   }   long long gcdByBit(long long a, long long b) {     if (!a || !b) return a | b;     unsigned shift = __builtin_ctz(a | b);     a >>= __builtin_ctzl(a);     do {       b >>= __builtin_ctzl(b);       if (a > b) {         swap(a, b);       }       b -= a;     } while (b);     return a << shift;   }   long long powerMod(long long n, long long p) {     long long res = 1;     while (p) {       if (p % 2 == 0) {         n = n * 1ll * n % 1000000007;         p /= 2;       } else {         res = res * 1ll * n % 1000000007;         p--;       }     }     return res;   }   long long powerMod2(long long b, long long p, long long m) {     if (p == 0) return 1;     return (b * powerMod2(b, p - 1, m) % m) % m;   }   long long fact(long long n) {     long long res = 1;     for (long long i = 1; i <= n; i++) {       res = res * 1ll * i % 1000000007;     }     return res;   }   long long nCr(long long n, long long r) {     return fact(n) * 1ll * powerMod(fact(r), 1000000007 - 2) % 1000000007 * 1ll *            powerMod(fact(n - r), 1000000007 - 2) % 1000000007;   }   long long arr[300005];   long long ans[300005];   long long parent(long long x) {     if (arr[x] != x) arr[x] = parent(arr[x]);     return arr[x];   }   void Chaliye_Shuru_Karte_Hai() {     for (long long i = 0; i < 300005; i++) arr[i] = i;     long long n, m;     cin >> n >> m;     for (long long i = 0; i < m; i++) {       long long a, b, c;       cin >> a >> b >> c;       for (long long j = parent(a); j <= b; j = parent(j + 1)) {         if (j != c) ans[j] = c, arr[j] = j + 1;       }     }     for (long long i = 1; i < n + 1; i++) cout << ans[i] <<    ;   }   signed main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long tc = 1;     while (tc--) {       Chaliye_Shuru_Karte_Hai();     }     return 0;   }   