#include <bits/stdc++.h>
using namespace std;
int s[300010], ans[300030];
int n, m;
int lowbit(int x) { return x & (-x); }
void update(int x, int y) {
  for (int i = x; i <= n; i += lowbit(i)) s[i] += y;
}
int getsum(int x) {
  int y = 0;
  for (int i = x; i > 0; i -= lowbit(i)) y += s[i];
  return y;
}
int main() {
  scanf("%d%d", &n, &m);
  memset(s, 0, sizeof(s));
  memset(ans, 0, sizeof(ans));
  for (int i = 1; i <= n; i++) update(i, 1);
  for (int i = 1; i <= m; i++) {
    int from, to, win;
    scanf("%d%d%d", &from, &to, &win);
    int low = getsum(from - 1), up = getsum(to);
    while (low < up) {
      int l = from - 1, r = to;
      while (l + 1 < r) {
        int mid = (l + r) / 2;
        if (getsum(mid) == low)
          l = mid;
        else
          r = mid;
      }
      l++;
      ans[l] = win;
      update(l, -1);
      up--;
    }
    ans[win] = 0;
    update(win, 1);
  }
  for (int i = 1; i < n; i++) printf("%d ", ans[i]);
  printf("%d\n", ans[n]);
  return 0;
}
