#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
int n, m;
int win[N];
bool seg[4 * N];
void update(int node, int start, int end, int l, int r, int w) {
  if (seg[node]) return;
  if (start == end) {
    if (w == start) return;
    seg[node] = 1;
    win[start] = w;
  } else {
    int mid = (start + end) / 2;
    if (mid >= l) {
      update(node * 2, start, mid, l, r, w);
    }
    if (mid + 1 <= r) {
      update(node * 2 + 1, mid + 1, end, l, r, w);
    }
    if (seg[node * 2] && seg[node * 2 + 1]) seg[node] = 1;
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int l, r, w;
    scanf("%d%d%d", &l, &r, &w);
    update(1, 1, n, l, r, w);
  }
  for (int i = 1; i <= n; i++) {
    printf("%d ", win[i]);
  }
  return 0;
}
