#include <bits/stdc++.h>
using namespace std;
int n,m;
int ans[300009];
int main()
{
scanf("%d%d",&n,&m);
vector<int> v(n,0);
for(int i=0;i<n;i++)v[i]=i+1;
while(m--)
{
int l,r,x;
scanf("%d%d%d",&l,&r,&x);
vector<int>::iterator it=upper_bound(v.begin(),v.end(),r);
vector<int>::iterator jt=lower_bound(v.begin(),v.end(),l);
jt++;
for(int i=jt-v.begin()-1;i<it-v.begin();i++)
if(v[i]!=x)ans[v[i]]=x;
v.erase(jt,it);
v[jt-v.begin()-1]=x;
}
for(int i=1;i<=n;i++)printf("%d ",ans[i]);
printf("\n");
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBuLG07CmludCBhbnNbMzAwMDA5XTsKaW50IG1haW4oKQp7CglzY2FuZigiJWQlZCIsJm4sJm0pOwoJdmVjdG9yPGludD4gdihuLDApOwoJZm9yKGludCBpPTA7aTxuO2krKyl2W2ldPWkrMTsKCXdoaWxlKG0tLSkKCXsKCQlpbnQgbCxyLHg7CgkJc2NhbmYoIiVkJWQlZCIsJmwsJnIsJngpOwoJCXZlY3RvcjxpbnQ+OjppdGVyYXRvciBpdD11cHBlcl9ib3VuZCh2LmJlZ2luKCksdi5lbmQoKSxyKTsKCQl2ZWN0b3I8aW50Pjo6aXRlcmF0b3IganQ9bG93ZXJfYm91bmQodi5iZWdpbigpLHYuZW5kKCksbCk7CgkJanQrKzsKCQlmb3IoaW50IGk9anQtdi5iZWdpbigpLTE7aTxpdC12LmJlZ2luKCk7aSsrKQoJCQlpZih2W2ldIT14KWFuc1t2W2ldXT14OwoJCXYuZXJhc2UoanQsaXQpOwoJCXZbanQtdi5iZWdpbigpLTFdPXg7Cgl9Cglmb3IoaW50IGk9MTtpPD1uO2krKylwcmludGYoIiVkICIsYW5zW2ldKTsKCXByaW50ZigiXG4iKTsKCXJldHVybiAwOwp9