#include <bits/stdc++.h>
using namespace std;
const int N = 3 * 1e5 + 10;
int n, m;
int A[N];
int p[N];
int f(int a) {
  if (a == p[a]) return a;
  return p[a] = f(p[a]);
}
int main(void) {
  cin >> n >> m;
  for (int i = 1; i <= n + 10; i++) p[i] = i;
  int a, b, c;
  for (int i = 1; i <= m; i++) {
    cin >> a >> b >> c;
    for (int j = f(a); j <= b; j = f(j + 1)) {
      if (j == c) continue;
      p[j] = f(j + 1);
      A[j] = c;
    }
  }
  for (int i = 1; i <= n; i++) cout << A[i] << ' ';
  return 0;
}
