#include <bits/stdc++.h>
using namespace std;
int n, m, l, r, x, ans[300300], tree[4 * 300300];
void build(int node, int st, int en) {
  if (st == en) {
    tree[node] = 1;
    return;
  }
  build((node << 1), st, (st + en) / 2);
  build((node << 1) + 1, ((st + en) / 2) + 1, en);
  tree[node] = tree[(node << 1)] + tree[(node << 1) + 1];
}
void update(int node, int st, int en, int left, int right, int val) {
  if (left > en || right < st) return;
  if (tree[node] == 0) return;
  if (st == en) {
    tree[node] = (st == x ? 1 : 0);
    ans[st] = val;
    return;
  }
  update((node << 1), st, (st + en) / 2, left, right, val);
  update((node << 1) + 1, ((st + en) / 2) + 1, en, left, right, val);
  tree[node] = tree[(node << 1)] + tree[(node << 1) + 1];
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  build(1, 1, n);
  while (m--) {
    cin >> l >> r >> x;
    update(1, 1, n, l, r, x);
  }
  ans[x] = 0;
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  cout << '\n';
  return 0;
}
