#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int P = 1e9 + 7;
const double PI = 3.14159265358979;
const long long lINF = 1e18;
const double eps = 1e-7;
int two_in[31];
vector<vector<int> > tree;
void upd(int l, int r, int w, int h = tree.size() - 1, int pos = 0) {
  if (r < l) return;
  if (tree[h].size() <= pos) return;
  if (tree[h][pos]) return;
  if (!h) {
    tree[h][pos] = w;
    return;
  }
  if (pos * two_in[h] == l && (pos + 1) * two_in[h] - 1 == r) {
    tree[h][pos] = w;
    return;
  }
  if (l <= (pos * 2 + 1) * two_in[h - 1] - 1)
    upd(l, min(r, (pos * 2 + 1) * two_in[h - 1] - 1), w, h - 1, pos * 2);
  if (r >= (pos * 2 + 1) * two_in[h - 1])
    upd(max(l, (pos * 2 + 1) * two_in[h - 1]), r, w, h - 1, pos * 2 + 1);
}
void dfs(int h = tree.size() - 1, int pos = 0) {
  if (!h) return;
  if (tree[h - 1][pos * 2])
    ;
  else
    tree[h - 1][pos * 2] = tree[h][pos];
  dfs(h - 1, pos * 2);
  if (pos * 2 + 1 < tree[h - 1].size()) {
    if (tree[h - 1][pos * 2 + 1])
      ;
    else
      tree[h - 1][pos * 2 + 1] = tree[h][pos];
    dfs(h - 1, pos * 2 + 1);
  }
}
int main() {
  two_in[0] = 1;
  for (int i = 1; i < 31; ++i) two_in[i] = two_in[i - 1] * 2;
  int n, m;
  cin >> n >> m;
  for (int i = n + 1; i > 1; i = (i + 1) / 2) tree.push_back(vector<int>(i, 0));
  tree.push_back(vector<int>(1, 0));
  for (int i = 0; i < m; ++i) {
    int l, r, w;
    cin >> l >> r >> w;
    upd(l, w - 1, w);
    upd(w + 1, r, w);
  }
  dfs();
  for (int i = 1; i <= n; ++i) cout << tree[0][i] << ' ';
  return 0;
}
