#include <bits/stdc++.h>
using namespace std;
const int maxn = 300005;
int beat[maxn], par[maxn];
int findset(int x) {
  if (par[x] != x) par[x] = findset(par[x]);
  return par[x];
}
int main() {
  int a, b, c;
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n + 1; i++) {
    par[i] = i;
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &a, &b, &c);
    int k = findset(a);
    while (k < c) {
      beat[k] = c;
      par[k] = k + 1;
      k = findset(k);
    }
    k = findset(c + 1);
    while (k <= b) {
      beat[k] = c;
      par[k] = k + 1;
      k = findset(k);
    }
  }
  for (int i = 1; i <= n; i++) {
    printf("%d%c", beat[i], i == n ? '\n' : ' ');
  }
}
