#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[300002];
  memset(arr, 0, sizeof arr);
  int n, m, l, r, x;
  cin >> n >> m;
  multiset<int> v;
  for (int i = 0; i < n; i++) v.insert(i + 1);
  for (int i = 0; i < m; i++) {
    cin >> l >> r >> x;
    multiset<int>::iterator it;
    it = v.lower_bound(l);
    while (it != v.end() && *it <= r) {
      if (arr[*it] == 0 && *it != x) {
        arr[*it] = x;
        multiset<int>::iterator newit = it;
        it++;
        v.erase(newit);
      } else
        it++;
    }
  }
  for (int i = 0; i < n; i++) cout << arr[i + 1] << " ";
}
