#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, ans[300005], x, y, z;
set<int> a;
set<int>::iterator it, it1;
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) a.insert(i);
  for (i = 1; i <= m; i++) {
    scanf("%d%d%d", &x, &y, &z);
    it = a.lower_bound(x);
    while (it != a.end() && *it <= y) {
      if (*it != z) {
        ans[*it] = z;
        it1 = it;
        it++;
        a.erase(it1);
      } else
        it++;
    }
  }
  for (i = 1; i <= n; i++) {
    if (i == 1)
      printf("%d", ans[i]);
    else
      printf(" %d", ans[i]);
  }
  printf("\n");
}
