#include <bits/stdc++.h>
using namespace std;
struct node {
  int value;
  int update;
};
node nodes[4 * 300007];
int L[300007], R[300007], x[300007];
void updateIT(int root, int left, int right, int i, int j, int val) {
  if (i > right || j < left) return;
  if (i <= left && right <= j) {
    nodes[root].value = val * (right - left + 1);
    nodes[root].update = val;
    return;
  }
  int mid = (left + right) / 2;
  if (nodes[root].update) {
    int k = nodes[root].update;
    nodes[root].update = 0;
    nodes[2 * root].value = k * (mid - left + 1);
    nodes[2 * root + 1].value = k * (right - mid);
    nodes[2 * root].update = k;
    nodes[2 * root + 1].update = k;
  }
  updateIT(2 * root, left, mid, i, j, val);
  updateIT(2 * root + 1, mid + 1, right, i, j, val);
  nodes[root].value = nodes[2 * root].value + nodes[2 * root + 1].value;
  return;
}
int queryIT(int root, int left, int right, int i) {
  if (i > right || i < left) return 0;
  if (i == left && i == right) return nodes[root].value;
  int mid = (left + right) / 2;
  if (nodes[root].update) {
    int k = nodes[root].update;
    nodes[root].update = 0;
    nodes[2 * root].value = k * (mid - left + 1);
    nodes[2 * root + 1].value = k * (right - mid);
    nodes[2 * root].update = k;
    nodes[2 * root + 1].update = k;
  }
  return queryIT(2 * root, left, mid, i) +
         queryIT(2 * root + 1, mid + 1, right, i);
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = (1); i <= (m); ++i) scanf("%d%d%d", &L[i], &R[i], &x[i]);
  for (int i = (m); i >= (1); --i) {
    int k = queryIT(1, 1, n, x[i]);
    updateIT(1, 1, n, L[i], R[i], x[i]);
    updateIT(1, 1, n, x[i], x[i], k);
  }
  for (int i = (1); i <= (n); ++i) {
    int k = queryIT(1, 1, n, i);
    if (k != i)
      printf("%d ", k);
    else
      printf("0 ");
  }
  return 0;
}
