#include <bits/stdc++.h>
using namespace std;
int least_power_of_2(int n) {
  int p = 1;
  while (p < n) p <<= 1;
  return p;
}
int *build_segment_tree(int n) {
  int len = 2 * least_power_of_2(n) - 1;
  int *segment_tree = new int[len];
  for (int i = 0; i < len; i++) segment_tree[i] = -1;
  return segment_tree;
}
void range_update(int l, int r, int x, int node, int node_l, int node_r,
                  int *tree) {
  if (l <= node_l && node_r <= r) {
    if (tree[node] == -1) tree[node] = x;
    return;
  } else if (r < node_l || l > node_r) {
    return;
  } else if (tree[node] == -1) {
    range_update(l, r, x, 2 * node + 1, node_l, (node_l + node_r) / 2, tree);
    range_update(l, r, x, 2 * node + 2, (node_l + node_r) / 2 + 1, node_r,
                 tree);
  }
}
void display(int *tree, int n) {
  for (int i = 0; i < n; i++) {
    cout << tree[i] << " ";
  }
  cout << endl;
}
int main() {
  int n, m, l, r, x, winner = 0;
  cin >> n >> m;
  int *tree = build_segment_tree(n);
  int first_index = least_power_of_2(n) - 1;
  int tree_len = 2 * least_power_of_2(n) - 1;
  while (m-- > 0) {
    cin >> l >> r >> x;
    l--;
    r--;
    x--;
    if (x != l) range_update(l, x - 1, x, 0, 0, first_index, tree);
    if (x != r) range_update(x + 1, r, x, 0, 0, first_index, tree);
    if (m == 0) winner = x;
  }
  int node;
  string output = "";
  if (winner == 0) {
    cout << "" << 0;
  } else {
    node = first_index;
    while (tree[node] == -1) node = (node - 1) / 2;
    cout << tree[node] + 1;
  }
  for (int i = first_index + 1; i < first_index + n; i++) {
    if (i - first_index == winner) {
      cout << " 0";
    } else {
      node = i;
      while (tree[node] == -1) {
        node = (node - 1) / 2;
      }
      cout << " " << tree[node] + 1;
      output += " " + (char(tree[node]) + ('0' - 0));
    }
  }
  cout << endl;
  return 0;
}
