#include <bits/stdc++.h>
using namespace std;
set<int> secior;
int t[300005], tmp[300005];
int main() {
  int n, m, a, b, c, d, e;
  scanf("%d%d", &n, &m);
  for (a = 1; a <= n; a++) secior.insert(a);
  while (m--) {
    scanf("%d%d%d", &a, &b, &c);
    d = 0;
    for (set<int>::iterator it = secior.lower_bound(a);
         it != secior.upper_bound(b); it++) {
      if (*it != c) {
        t[*it] = c;
        tmp[d++] = *it;
      }
    }
    for (a = 0; a < d; a++) secior.erase(tmp[a]);
  }
  for (a = 1; a <= n; a++) printf("%d ", t[a]);
  return 0;
}
