#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
const int MOD = 1e9 + 7;
int ans[N];
vector<int> v[19];
void solve() {
  int n, m;
  set<int> s;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) s.insert(i);
  int a, b, c;
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &a, &b, &c);
    for (int i = a; i <= b; i++) {
      if (ans[i] != 0) break;
      ans[i] = c;
      s.erase(s.find(i));
    }
    for (int i = b; i > a; i--) {
      if (ans[i] != 0) break;
      ans[i] = c;
      s.erase(s.find(i));
    }
    set<int>::iterator x = s.lower_bound(a);
    while (x != s.end() && *x <= b) {
      ans[*x] = c;
      s.erase(x);
      x = s.lower_bound(a);
    }
    s.insert(c);
  }
  ans[c] = 0;
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  puts("");
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
}
