#include <bits/stdc++.h>
using namespace std;
const int __precision = 13;
const long long inf = 1e14;
const int mod = ((int)1e9) + 9;
vector<int> a, st;
void push(int ind) {
  int chl = ind * 2;
  int chr = chl + 1;
  if (chl < st.size() and st[chl] == 0) {
    st[chl] = st[ind];
  }
  if (chr < st.size() and st[chr] == 0) {
    st[chr] = st[ind];
  }
  st[ind] = 0;
}
void setval(int ind, int l, int r, int ll, int rr, int val) {
  if (r < ll or l > rr) {
    return;
  }
  if (l >= ll and r <= rr) {
    st[ind] = val;
    return;
  }
  push(ind);
  int mid = (l + r) / 2;
  int chl = ind * 2;
  int chr = chl + 1;
  setval(chl, l, mid, ll, rr, val);
  setval(chr, mid + 1, r, ll, rr, val);
}
void update(int ind, int l, int r, int ll, int rr, int val) {
  if (r < ll or l > rr) {
    return;
  }
  if (l >= ll and r <= rr) {
    st[ind] = st[ind] == 0 ? val : st[ind];
    return;
  }
  push(ind);
  int mid = (l + r) / 2;
  int chl = ind * 2;
  int chr = chl + 1;
  update(chl, l, mid, ll, rr, val);
  update(chr, mid + 1, r, ll, rr, val);
}
int query(int ind, int l, int r, int ll, int rr) {
  if (r < ll or l > rr or ind >= st.size()) {
    return 0;
  }
  if (l >= ll and r <= rr) {
    return st[ind];
  }
  push(ind);
  int mid = (l + r) / 2;
  int chl = ind * 2;
  int chr = chl + 1;
  int ansl = query(chl, l, mid, ll, rr);
  int ansr = query(chr, mid + 1, r, ll, rr);
  if (ansl != 0) {
    return ansl;
  }
  if (ansr != 0) {
    return ansr;
  }
  return st[ind];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(__precision);
  cout.setf(ios_base::fixed);
  int n, m;
  cin >> n >> m;
  st = vector<int>(n * 4, 0);
  for (int i = 0; i < m; ++i) {
    int l, r, x;
    cin >> l >> r >> x;
    update(1, 1, n, l, r, x);
    setval(1, 1, n, x, x, 0);
  }
  for (int i = 1; i <= n; ++i) {
    cout << query(1, 1, n, i, i) << " ";
  }
  return 0;
}
