#include <bits/stdc++.h>
using namespace std;
const int N = 2e6, PI = 3.14159265359, M = 1e9 + 7;
vector<int> v[N];
int win[N];
bool mark[N];
void build(int c, int b, int e) {
  for (int i = b; i < e; i++) v[c].push_back(i);
  if (e - b == 1) return;
  int mid = (b + e) / 2;
  build(c * 2, b, mid);
  build(c * 2 + 1, mid, e);
}
void seg(int c, int t, int b, int e, int i, int j) {
  if (mark[c] == true) return;
  if (b == i && e == j) {
    mark[c] = true;
    for (auto it : v[c]) {
      if (!win[it]) win[it] = t;
    }
    v[c].clear();
    if ((t - 1) >= i && (t - 1) < j) {
      mark[c] = false;
      v[c].push_back(t - 1);
      win[t - 1] = 0;
    }
    return;
  }
  int mid = (b + e) / 2;
  if (j <= mid)
    seg(c * 2, t, b, mid, i, j);
  else if (i >= mid)
    seg(c * 2 + 1, t, mid, e, i, j);
  else
    seg(c * 2, t, b, mid, i, mid), seg(c * 2 + 1, t, mid, e, mid, j);
}
int main() {
  int n, m;
  cin >> n >> m;
  build(1, 0, n);
  for (int i = 0; i < m; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    seg(1, z, 0, n, x - 1, y);
  }
  for (int i = 0; i < n; i++) cout << win[i] << " ";
  return 0;
}
