#include <bits/stdc++.h>
int FASTBUFFER;
using namespace std;
int n, m, ans[500005];
set<int> s;
vector<int> v;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) s.insert(i);
  for (int i = 1; i <= m; i++) {
    int l, r, x;
    scanf("%d %d %d", &l, &r, &x);
    v.clear();
    for (set<int>::iterator it = s.lower_bound(l); it != s.end() && *it <= r;
         ++it)
      if (*it != x) v.push_back(*it);
    for (vector<int>::iterator it = v.begin(); it != v.end(); ++it)
      ans[*it] = x, s.erase(*it);
  }
  for (int i = 1; i <= n; i++)
    if (i == n)
      printf("%d\n", ans[i]);
    else
      printf("%d ", ans[i]);
  return 0;
}
