#include <bits/stdc++.h>
using namespace std;
const int N = (int)4e6 + 11;
const long long inf = 1e9 + 7;
int n, m, p[1 << 20], can[1 << 20];
int find_parent(int x) {
  if (x == p[x]) {
    return x;
  }
  return p[x] = find_parent(p[x]);
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < 1 + n; ++i) {
    p[i] = i;
  }
  memset(can, -1, sizeof(can));
  for (int i = 0; i < m; ++i) {
    int l, r, x;
    scanf("%d %d %d", &l, &r, &x);
    --x;
    l = find_parent(l - 1);
    while (l < r) {
      if (l != x) {
        can[l] = x;
        p[l] = 1 + l;
      }
      l = find_parent(1 + l);
    }
  }
  for (int i = 0; i < n; ++i) {
    printf("%d ", can[i] + 1);
  }
  return 0;
}
