#include <bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589793238;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= 1000000007;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
  }
  return res;
}
int l, r, winner, beat[2000005];
typedef struct A {
  int left, right, val;
} A;
A seg[2000005];
void update(int node, int start, int end) {
  if (start > r || l > end)
    return;
  else if (start >= l && end <= r) {
    if (seg[node].val) {
      if (beat[seg[node].val] == seg[node].val) {
        beat[seg[node].val] = winner;
        seg[node].val = winner;
      }
    } else if (seg[node].left && seg[node].right) {
      if (beat[seg[node].left] == seg[node].left) {
        beat[seg[node].left] = winner;
      }
      if (beat[seg[node].right] == seg[node].right) {
        beat[seg[node].right] = winner;
      }
      seg[node].val = winner;
    } else if (start == end) {
      seg[node].val = seg[node].left = seg[node].right = winner;
      beat[start] = winner;
    } else {
      int mid = (start + end) >> 1;
      update(2 * node, start, mid);
      update(2 * node + 1, mid + 1, end);
      seg[node].left = seg[2 * node].val;
      seg[node].right = seg[2 * node + 1].val;
      if (seg[node].left == seg[node].right) seg[node].val = seg[node].left;
    }
  } else {
    int mid = (start + end) >> 1;
    update(2 * node, start, mid);
    update(2 * node + 1, mid + 1, end);
    seg[node].left = seg[2 * node].val;
    seg[node].right = seg[2 * node + 1].val;
    if (seg[node].left == seg[node].right) seg[node].val = seg[node].left;
  }
}
int main() {
  int n, q;
  scanf("%d", &n);
  scanf("%d", &q);
  while (q--) {
    scanf("%d %d %d", &l, &r, &winner);
    update(1, 1, n);
  }
  for (int i = 1; i <= n; i++) {
    if (beat[i] == i)
      printf("0 ");
    else
      printf("%d ", beat[i]);
  }
  return !printf("\n");
  ;
}
