#include <bits/stdc++.h>
using namespace std;
int nxt[300005];
int ans[300005];
int find(int x) {
  if (x == nxt[x]) return x;
  nxt[x] = find(nxt[x]);
  return nxt[x];
}
int main() {
  int n, m, l, r, x;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) nxt[i] = i;
  nxt[n + 1] = n + 1;
  while (m--) {
    scanf("%d%d%d", &l, &r, &x);
    while (l <= r) {
      if (nxt[l] == l) {
        if (l != x) {
          ans[l] = x;
          nxt[l] = find(nxt[l + 1]);
          l = nxt[l];
        } else
          l = find(nxt[l + 1]);
      } else
        l = find(nxt[l]);
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
