#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define pb push_back
signed main() {
ios_base::sync_with_stdio(0);cin.tie(0);
int n, q;
cin >> n >> q;
vector<vector<array<int, 3>>> l(n + 1), r(n + 1);
for(int i = 1; i <= q; i++) {
int a, b, c;
cin >> a >> b >> c;
l[a].pb({a, b, c});
r[b].pb({a, b, c});
}
multiset<int> s;
for(int i = 1; i <= n; i++) {
for(auto &[a, b, c] : r[i - 1]) {
s.erase(s.find(c - a));
}
for(auto &[a, b, c] : l[i]) {
s.insert(c - i);
}
if(s.empty()) cout << 0 << " ";
else {
auto it = s.end();
it--;
cout << i + *it << " ";
}
}
return 0;
}