#include <bits/stdc++.h>
const int MAXN = 300100;
using namespace std;
inline int c1(int n) { return (n << 1); }
inline int c2(int n) { return (n << 1) | 1; }
int ans[4 * MAXN];
int lazy[4 * MAXN];
int x[MAXN], y[MAXN], winner[MAXN];
void build(int node, int start, int end) {
  if (start == end) {
    ans[node] = 0;
    return;
  }
  int mid = start + end >> 1;
  build(c1(node), start, mid);
  build(c2(node), mid + 1, end);
  ans[node] = 0;
}
void update(int node, int start, int end, int l, int r, int v) {
  if (lazy[node]) {
    ans[node] = lazy[node];
    if (start != end) lazy[c1(node)] = lazy[c2(node)] = lazy[node];
    lazy[node] = 0;
  }
  if (start > end || r < start || end < l) return;
  if (l <= start && end <= r) {
    ans[node] = v;
    if (start != end) lazy[c1(node)] = lazy[c2(node)] = v;
    return;
  }
  int mid = start + end >> 1;
  update(c1(node), start, mid, l, r, v);
  update(c2(node), mid + 1, end, l, r, v);
}
int pointQuery(int node, int start, int end, int l) {
  if (lazy[node]) {
    ans[node] = lazy[node];
    if (start != end) lazy[c1(node)] = lazy[c2(node)] = lazy[node];
    lazy[node] = 0;
  }
  if (start > end || l < start || end < l) return -1;
  if (start == end && start == l) return ans[node];
  int mid = start + end >> 1;
  if (l <= mid) return pointQuery(c1(node), start, mid, l);
  return pointQuery(c2(node), mid + 1, end, l);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  build(1, 1, n);
  for (int i = 0; i < m; i++) cin >> x[i] >> y[i] >> winner[i];
  for (int i = m - 1; i >= 0; i--) {
    if (x[i] != winner[i]) update(1, 1, n, x[i], winner[i] - 1, winner[i]);
    if (winner[i] != y[i]) update(1, 1, n, winner[i] + 1, y[i], winner[i]);
  }
  for (int i = 1; i <= n; i++) cout << pointQuery(1, 1, n, i) << ' ';
  cout << '\n';
  return 0;
}
