#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, l, r, x, j, l1, r1, x1;
  cin >> n >> m;
  int my[300005] = {0};
  for (i = 1; i <= m; i++) {
    cin >> l >> r >> x;
    if (i > 1) {
      if (x != x1 && x1 <= r && x1 >= l) my[x1] = x;
    }
    if (i == 1) {
      for (j = l; j <= r; j++) {
        if (my[j] == 0 && j != x) {
          my[j] = x;
        }
      }
      l1 = l;
      r1 = r;
    } else {
      if (l1 > r) l1 = r + 1;
      for (j = l; j < l1; j++) {
        if (my[j] == 0 && j != x) {
          my[j] = x;
        }
      }
      if (r1 < l) r1 = l;
      for (j = r1; j <= r; j++) {
        if (my[j] == 0 && j != x) {
          my[j] = x;
        }
      }
      l1 = l;
      r1 = r;
    }
    x1 = x;
  }
  for (i = 1; i <= n; i++) {
    cout << my[i] << " ";
  }
  return 0;
}
