#include <bits/stdc++.h>
#include <fstream>
using namespace std;
#define read(type) readInt<type>() // Fast read
#define ll long long
#define nL "n"
#define pb push_back
#define mk make_pair
#define pii pair<int, int>
#define a first
#define b second
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define umap unordered_map
#define uset unordered_set
#define MOD 1000000007
#define imax INT_MAX
#define imin INT_MIN
#define exp 1e9
#define sz(x) (int((x).size()))
vector<int> solve() {
int k, f; cin >> k >> f;
vector<int> freq(k, 0);
vector<pair<pair<int,int>, int>> fights;
for(auto i = 0; i < f; i++) {
int x, y, w; cin >> x >> y >> w;
fights.push_back(mk(mk(x, y), w));
}
sort(all(fights));
int ox, oy, ow; ox = fights[0].a.a; oy = fights[0].a.b; ow = fights[0].b;
pair<int, int> lim = mk(ox , oy);
for(auto i = ox; i <= oy; i++) {
if (i != ow) {freq[i-1] = ow;}
}
int prevW = ow;
for(auto i = 1; i < f; i++) {
int x, y, curW; x = fights[i].a.a; y = fights[i].a.b; curW = fights[i].b;
if (prevW != curW) {freq[prevW-1] = curW;}
prevW = curW;
if (lim.a > x) {
for(auto i = x; i < lim.a; i++) {
if (i == curW) {continue;}
freq[i-1] = curW;
}
}
if (lim.b < y) {
for(auto i = lim.b+1; i <= y; i++) {
if (i == curW) {continue;}
freq[i-1] = curW;
}
}
lim.a = x; lim.b = y;
}
return freq;
}
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(null);
auto res = solve();
for(auto crap : res) {
cout << crap << " ";
}
return 0;
}