#include <algorithm>
#include <array>
#include <cstdint>
#include <cstdio>
#include <iostream>
#include <tuple>
#include <vector>

using ll = int64_t;

bool is_num(char c){
    return '0'<=c&&c<='9';
}

ll getnum(){
    char c;
    do {
        c=getchar();
    }while (!is_num(c));
    ll n=c-'0';
    while (is_num(c=getchar())) {
        n=n*10+c-'0';
    }
    return n;
}

const ll maxn=1e6+5;
std::vector<std::tuple<ll,ll,ll>> v;
std::vector<ll> nxt;
std::vector<ll> ans;

ll getfather(ll n){
    if(nxt[n]==n)return n;
    nxt[n] = getfather(nxt[n]);
    return nxt[n];
}

// #define NV(v) {std::cout<<#v<<" : "<<(v)<<'\n';}
#define NV(v)

int main(){
    v.resize(maxn);
    nxt.resize(maxn);
    ans.resize(maxn);

    ll n,q;
    n=getnum();
    q=getnum();
    for(ll i=1;i<=q;i++){
        ll x,y,z;
        x=getnum();y=getnum();z=getnum();
        v[i]={x,y,z};
    }
    for(ll i=1;i<=n+1;i++)nxt[i]=i;
    for(ll i=n;i>=1;i--){
        auto[l,r,c] = v[i];
        NV(l)NV(r)NV(c)
        ll idx=getfather(l);
        while(idx<=r){
            NV(idx)
            ans[idx]=c;
            nxt[idx]=getfather(getfather(idx+1));
            idx=getfather(idx);
        }
    }
    for(ll i=1;i<=n;i++){
        std::cout<<ans[i]<<' ';
    }
    std::cout<<'\n';
}