#include <bits/stdc++.h>
using namespace std;
int p[300002];
set<int> s;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n, m;
  scanf("%d%d", &n, &m);
  for (int(i) = (1); (i) < (n + 1); (i)++) s.insert(i);
  for (int(i) = (0); (i) < (m); (i)++) {
    int x, y, z;
    scanf("%d%d%d", &x, &y, &z);
    set<int>::iterator it = s.lower_bound(x);
    vector<int> v;
    int u;
    while ((u = *it) <= y && it != s.end()) {
      if (u != z) {
        p[u] = z;
        v.push_back(u);
      }
      it++;
    }
    for (int(i) = (0); (i) < (((int)v.size())); (i)++) s.erase(v[i]);
  }
  for (int(i) = (1); (i) < (n + 1); (i)++) {
    printf("%d", p[i]);
    if (i != n)
      printf(" ");
    else
      printf("\n");
  }
  return 0;
}
