#include <bits/stdc++.h>
using namespace std;
int n, m, ans;
int seg[1200001];
void fix(int c, int l, int r, int s, int e, int winner) {
  if (l > e || r < s || seg[c] != -1) return;
  if (l >= s && r <= e && (winner > r || winner < l)) {
    seg[c] = winner;
    return;
  }
  if (l == r && l == winner) return;
  fix(c * 2 + 1, l, (l + r) / 2, s, e, winner);
  fix(c * 2 + 2, (l + r) / 2 + 1, r, s, e, winner);
}
void find(int c, int l, int r, int v) {
  if (l > v || r < v) return;
  if (l == r && l == v) {
    if (seg[c] != v && seg[c] != -1) ans = seg[c];
    return;
  }
  find(c * 2 + 1, l, (l + r) / 2, v);
  find(c * 2 + 2, (l + r) / 2 + 1, r, v);
  if (ans == -1 && seg[c] != -1 && seg[c] != v) ans = seg[c];
}
int main() {
  scanf("%d%d", &n, &m);
  memset(seg, -1, sizeof(seg));
  for (int l, r, x, i = 0; i < m; i++) {
    scanf("%d%d%d", &l, &r, &x);
    l--;
    r--;
    x--;
    fix(0, 0, n - 1, l, r, x);
  }
  for (int i = 0; i < n; i++) {
    ans = -1;
    find(0, 0, n - 1, i);
    printf("%d ", ans + 1);
  }
}
