#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int N = 3e5+5;
int n, q;
multiset<int> add[N], rem[N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n >> q;
for(int i = 0; i < q; i++) {
int l, r, x;
cin >> l >> r >> x;
l--;
r--;
add[l].insert(x - l);
rem[r + 1].insert(x - l);
}
multiset<int> cur;
for(int i = 0; i < n; i++) {
for(int x : rem[i]) {
cur.erase(cur.find(-x));
}
for(int x : add[i]) {
cur.insert(-x);
}
int now = 0;
if(cur.size()) now = -(*cur.begin()) + i;
cout << now << " ";
}
return 0;
}