/*
** jan25
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
int N = 300005;
using namespace std;
int next[300005];
int ans[300005];
int getn(int i) {
if (next[i] == i) return i;
else return (next[i] = getn(next[i]));
}
int main() {
int n, m; cin>> n >> m;
int a, b, i, j, k;
i = 1;
while (i <= n) next[i] = i++;
while (m--) {
scanf("%d%d%d", &i, &j, &k);
while (i <= j) {
i = getn(i);
if (i != k) ans[i] = k;
if (i < k) next[i] = k;
else if (i > k) next[i] = j+1;
++i;
}
}
i = 1;
while (i <= n) {
if (ans[i] != i) printf("%d ", ans[i]);
else printf("0 ");
++i;
}
return 0;
}
LyoKKioJamFuMjUKKi8KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0ZGlvPgojaW5jbHVkZSA8Y3N0cmluZz4KI2luY2x1ZGUgPHZlY3Rvcj4KCmludCBOID0gMzAwMDA1OwoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBuZXh0WzMwMDAwNV07CmludCBhbnNbMzAwMDA1XTsgCgppbnQgZ2V0bihpbnQgaSkgewoJaWYgKG5leHRbaV0gPT0gaSkgcmV0dXJuIGk7CgllbHNlIHJldHVybiAobmV4dFtpXSA9IGdldG4obmV4dFtpXSkpOwp9CgppbnQgbWFpbigpIHsKCWludCBuLCBtOyBjaW4+PiBuID4+IG07CgkKCQoJaW50IGEsIGIsIGksIGosIGs7CglpID0gMTsKCXdoaWxlIChpIDw9IG4pIG5leHRbaV0gPSBpKys7CgkKCXdoaWxlIChtLS0pIHsKCQlzY2FuZigiJWQlZCVkIiwgJmksICZqLCAmayk7CgkJCgkJd2hpbGUgKGkgPD0gaikgewoJCQlpID0gZ2V0bihpKTsKCQkJaWYgKGkgIT0gaykgYW5zW2ldID0gazsKCQkJaWYgKGkgPCBrKSBuZXh0W2ldID0gazsKCQkJZWxzZSBpZiAoaSA+IGspIG5leHRbaV0gPSBqKzE7CgkJCSsraTsKCQl9Cgl9CgkKCWkgPSAxOwoJd2hpbGUgKGkgPD0gbikgewoJCWlmIChhbnNbaV0gIT0gaSkgcHJpbnRmKCIlZCAiLCBhbnNbaV0pOwoJCWVsc2UgcHJpbnRmKCIwICIpOwoJCSsraTsKCX0KCQoJcmV0dXJuIDA7Cn0K