#include <bits/stdc++.h>
using namespace std;
const int N = (int)3e5 + 5;
int n, m;
int getNext[N], res[N];
void initSet() {
  for (int i = 1; i <= n + 1; i++) getNext[i] = i;
}
int next(int i) {
  return (getNext[i] == i) ? i : (getNext[i] = next(getNext[i]));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  initSet();
  for (int i = 1; i <= m; i++) {
    int l, r, x;
    cin >> l >> r >> x;
    for (int j = next(l); j < x; j = next(j + 1)) {
      res[j] = x;
      getNext[j] = x;
    }
    for (int j = next(x + 1); j <= r; j = next(j + 1)) {
      res[j] = x;
      getNext[j] = next(r + 1);
    }
  }
  for (int i = 1; i <= n; i++) cout << res[i] << " ";
}
