#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const double eps = 1e-9;
const double pi = acos(-1.0);
int n, m;
int ans[300300];
int main() {
  scanf("%d%d", &n, &m);
  set<int> S;
  for (int i = 1; i <= n; i++) S.insert(i);
  for (int iter = 0; iter < m; iter++) {
    int l, r, x;
    scanf("%d%d%d", &l, &r, &x);
    vector<int> temp;
    for (set<int>::iterator it = S.lower_bound(l); it != S.end() && (*it) <= r;
         it++) {
      if (*it == x) continue;
      ans[*it] = x;
      temp.push_back(*it);
    }
    for (__typeof(temp.begin()) it = temp.begin(); it != temp.end(); it++) {
      S.erase(*it);
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
