#include <bits/stdc++.h>
using namespace std;
vector<int> parent, last;
int findParent(int u) {
  if (parent[u] == u) return u;
  return parent[u] = findParent(parent[u]);
}
int findLast(int u) {
  if (last[u] == u) return u;
  return last[u] = findLast(last[u]);
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<int> win(n + 1);
  parent.assign(n + 1, -1);
  last.assign(n + 1, 0);
  for (int i = 1; i <= n; i++) parent[i] = i, win[i] = i, last[i] = i;
  vector<bool> v(n + 1, 0);
  int a, b, c;
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &a, &b, &c);
    for (int j = a; j <= b; j++) {
      if (!v[j]) {
        v[j] = 1, parent[j] = c, win[j] = c, last[j] = b;
        continue;
      }
      int x = findParent(j), l = findLast(j);
      last[j] = max(l, b);
      if (x <= b) parent[x] = c, win[x] = c;
      j = l;
    }
  }
  win[c] = 0;
  for (int i = 1; i <= n; i++) printf("%d ", win[i]);
}
