#include <bits/stdc++.h>
using namespace std;
int knigths[300006];
set<int> s;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  ios::sync_with_stdio(false), cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n + 1; i++) s.insert(i);
  for (int i = 0; i < m; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    set<int>::iterator itl = s.lower_bound(a);
    set<int>::iterator itu = s.upper_bound(b);
    while (*itl < *itu) {
      if (*itl != c) {
        knigths[*itl] = c;
      }
      s.erase(itl);
      itl = s.lower_bound(a);
      itu = s.upper_bound(b);
    }
    s.insert(c);
  }
  for (int i = 1; i <= n; i++) cout << knigths[i] << " ";
  cout << endl;
  return 0;
}
