#include <bits/stdc++.h>
using namespace std;
int go[300010], res[300010], p[300010];
int findroot(int x) {
  if (res[p[x]]) p[x] = findroot(p[x]);
  return p[x];
}
int main() {
  int n, m, l, r, x;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) p[i] = i, go[i] = i + 1;
  go[n] = 0;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &l, &r, &x);
    int g = 0;
    for (int j = l; j <= r && j >= l;) {
      int k = findroot(j);
      if (res[k] == 0 && k != x && k >= l && k <= r) res[k] = x;
      if (res[k]) {
        p[k] = x;
        g = max(g, go[k]);
      }
      j = go[k];
    }
    go[x] = max(r + 1, go[x]);
    go[x] = max(go[x], g);
  }
  for (int i = 1; i <= n; i++) cout << res[i] << " ";
}
