#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
void maximize(T &x, U y) {
  if (x < y) x = y;
}
template <class T, class U>
void minimize(T &x, U y) {
  if (x > y) x = y;
}
template <class T>
T Abs(T x) {
  return (x < 0 ? -x : x);
}
template <class T>
T safe_sqrt(T x) {
  return sqrt(max(x, (T)0));
}
template <class T, class U, class V>
T addmod(T x, U k, V MOD) {
  return ((x + k) % MOD + MOD) % MOD;
}
template <class T, class U, class V>
T submod(T x, U k, V MOD) {
  return ((x - k) % MOD + MOD) % MOD;
}
template <class T, class U, class V>
T mul(T x, U y, V MOD) {
  return (long long)x * y % MOD;
}
namespace taskC {
const int N = 3e5 + 5;
int prev[N], next[N], ans[N];
int n, m;
void solve() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) next[i] = i + 1, prev[i] = i - 1;
  for (int l, r, x, i = 1; i <= m; i++) {
    scanf("%d%d%d", &l, &r, &x);
    for (int p = next[x];; p = next[p]) {
      if (p > r) {
        prev[p] = x, next[x] = p;
        break;
      }
      ans[p] = x;
    }
    for (int p = prev[x];; p = prev[p]) {
      if (p < l) {
        next[p] = x, prev[x] = p;
        break;
      }
      ans[p] = x;
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
}
}  // namespace taskC
int main(void) { taskC::solve(); }
