#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
constexpr int N = 3e5;
vector<pair<int,int>> wyd[N+9];
int odp[N+9];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,m,l,r,c;
cin >> n >> m;
for (int x=1;x<=m;x++){
cin >> l >> r >> c;
c-=l;
wyd[l].push_back({c,x});
wyd[r+1].push_back({c,-x});
}
set<pair<int,int>> ter; ter.insert({-2e9,-1});
for (int x=1;x<=n;x++){
for (pair<int,int> y:wyd[x]){
if (y.second>0)ter.insert(y);
else ter.erase({y.first,-y.second});
}
odp[x]=(*ter.rbegin()).first+x;
}
for (int x=1;x<=n;x++) cout << max(odp[x],0) << ' ';
cout << '\n';
return 0;
}