#include <bits/stdc++.h>
using namespace std;
long long Min(long long i, long long j) { return i < j ? i : j; }
long long Max(long long i, long long j) { return i > j ? i : j; }
int val[2000000], done[2000000], upd[2000000];
int n, m;
void upd_node(int node, int b, int e) {
  if (upd[node] != -1) {
    if (done[node])
      upd[node] = -1;
    else {
      val[node] = upd[node];
      done[node] = 1;
      if (b != e) {
        upd[node * 2] = upd[node];
        upd[node * 2 + 1] = upd[node];
      }
      upd[node] = -1;
    }
  }
}
int update(int node, int b, int e, int i, int j, int v) {
  if (i > j) return 0;
  upd_node(node, b, e);
  if (e < i || b > j) return val[node];
  if (b >= i && e <= j) {
    if (done[node]) return val[node];
    val[node] = v;
    if (b != e) {
      upd[node * 2] = v;
      upd[node * 2 + 1] = v;
    }
    done[node] = 1;
    return val[node];
  }
  int l = update(node * 2, b, (b + e) / 2, i, j, v);
  int r = update(node * 2 + 1, (b + e) / 2 + 1, e, i, j, v);
  val[node] = Min(l, r);
  return val[node];
}
int read(int node, int b, int e, int i, int j) {
  upd_node(node, b, e);
  if (e < i || b > j) return 2000000000;
  if (b >= i && e <= j) return val[node];
  int l = read(node * 2, b, (b + e) / 2, i, j);
  int r = read(node * 2 + 1, (b + e) / 2 + 1, e, i, j);
  return Min(l, r);
}
int main() {
  int a, b, c, d, e, i, j, k, l;
  while (cin >> n >> m) {
    memset(val, 0, sizeof(val));
    memset(done, 0, sizeof(done));
    memset(upd, -1, sizeof(upd));
    for (i = 1; i <= m; i++) {
      cin >> j >> k >> l;
      update(1, 1, n, j, l - 1, l);
      update(1, 1, n, l + 1, k, l);
    }
    for (i = 1; i <= n; i++) cout << read(1, 1, n, i, i) << ' ';
    cout << endl;
  }
  return 0;
}
