#include <bits/stdc++.h>
using namespace std;
int a[300005], b[300005];
void update(int p, int x) {
  while (p < 300005) {
    b[p] += x;
    p += p & -p;
  }
}
int query(int p) {
  int ret = 0;
  while (p > 0) {
    ret += b[p];
    p -= p & -p;
  }
  return ret;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  while (cin >> n >> m) {
    memset(a, 0, sizeof(a));
    for (int i = (1); i <= (n); i++) update(i, 1);
    for (int i = (1); i <= (m); i++) {
      int l, r, x;
      cin >> l >> r >> x;
      while (l < r - 1) {
        if (l == x) {
          l++;
          continue;
        }
        if (a[l] == 0) {
          a[l] = x;
          update(l, -1);
          l++;
          continue;
        }
        int L = l, R = r;
        int now = query(l) + 1;
        while (L < R - 1) {
          int mid = (L + R) >> 1;
          if (query(mid) >= now)
            R = mid;
          else
            L = mid;
        }
        l = R;
        if (a[l] == 0 && l != x) {
          a[l] = x;
          update(l, -1);
        }
      }
      for (int j = (l); j <= (r); j++) {
        if (j == x || a[j] > 0) continue;
        a[j] = x;
        update(j, -1);
      }
    }
    for (int i = (1); i <= (n); i++) printf("%d ", a[i]);
    printf("\n");
  }
  return 0;
}
