#include <bits/stdc++.h>
using namespace std;
long long int add(long long int a, long long int b) {
  return (a % 1000000009 + b % 1000000009) % 1000000009;
}
long long int sub(long long int a, long long int b) {
  return (a % 1000000009 - b % 1000000009 + 1000000009) % 1000000009;
}
long long int mul(long long int a, long long int b) {
  return (a % 1000000009 * b % 1000000009) % 1000000009;
}
unsigned long long poww(unsigned long long a, unsigned long long b) {
  unsigned long long res = 1;
  while (b) {
    if (b & 1) {
      res *= a;
    }
    a = a * a;
    b >>= 1;
  }
  return res;
}
long long int poww(long long int a, long long int b, long long int MOD) {
  long long int res = 1;
  while (b) {
    if (b & 1) {
      res *= a;
      res %= MOD;
    }
    a = a * a;
    a %= MOD;
    b >>= 1;
  }
  return res;
}
const int N = 3e5 + 5;
int nxt[N];
int ans[N];
int find_(int u) { return nxt[u] == u ? u : nxt[u] = find_(nxt[u]); }
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  for (long long int i = 0; i <= N - 1; i++) nxt[i] = i;
  int n, m;
  cin >> n >> m;
  int l, r, x;
  for (long long int i = 0; i <= m - 1; i++) {
    cin >> l >> r >> x;
    int curr = find_(l);
    while (curr <= r) {
      if (curr == x) {
        curr += 1;
      } else {
        ans[curr] = x;
        nxt[curr] = curr + 1;
      }
      curr = find_(curr);
    }
  }
  for (long long int i = 1; i <= n; i++) {
    cout << ans[i] << ' ';
  }
  cout << '\n';
  return 0;
}
