#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 350001;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
int n, m, L, R, win;
int fa[MAX_N], beat[MAX_N];
int find(int k) { return fa[k] != k ? fa[k] = find(fa[k]) : k; }
void solve(int L, int R, int win) {
  while (L <= R) {
    L = find(L);
    if (L != win) {
      beat[L] = win;
      fa[L] = fa[L + 1];
    }
    L = find(L + 1);
  }
}
int main() {
  ios::sync_with_stdio(0);
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n + 1; i++) fa[i] = i;
  for (int i = 0; i < m; i++) {
    scanf("%d %d %d", &L, &R, &win);
    solve(L, R, win);
  }
  for (int i = 1; i <= n; i++) printf("%d ", beat[i]);
  return 0;
}
