#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 300010;
set<int> s;
set<int>::iterator it, tmp, res;
int ans[MAXN];
int N, M;
int main() {
  while (scanf("%d%d", &N, &M) != EOF) {
    s.clear();
    memset(ans, 0, sizeof(ans));
    for (int i = 1; i <= N; i++) s.insert(i);
    for (int i = 0; i < M; i++) {
      int u, v, x;
      scanf("%d%d%d", &u, &v, &x);
      tmp = s.lower_bound(u);
      for (it = tmp; (*it) <= v && it != s.end();) {
        int val = *it;
        if (val != x) ans[val] = x;
        it++;
        if (val != x) s.erase(val);
      }
    }
    for (int i = 1; i <= N; i++) printf("%d ", ans[i]);
  }
  return 0;
}
