#include <bits/stdc++.h>
using namespace std;
using ll = long long;
long long ncr(int n, int r) {
  if (r > n - r) r = n - r;
  long long ans = 1;
  int i;
  for (i = 1; i <= r; i++) {
    ans *= n - r + i;
    ans /= i;
  }
  return ans;
}
ll mod(ll a, ll b, ll m) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    ll y = mod(a, b / 2, m);
    return (y * y) % m;
  } else {
    return ((a % m) * mod(a, b - 1, m)) % m;
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  set<int> s;
  vector<int> v(n + 1);
  for (int i = 1; i <= n; i++) s.insert(i);
  for (int i = 0; i < m; i++) {
    int l, r, x;
    cin >> l >> r >> x;
    auto it = s.lower_bound(l);
    vector<int> ff;
    while (it != s.end() && *it <= r) {
      if (*it == x) {
        it++;
        continue;
      }
      ff.push_back(*it);
      v[*it] = x;
      it++;
    }
    for (auto x : ff) {
      s.erase(x);
    }
  }
  for (int j = 1; j <= n; j++) {
    if (v[j] == -1) v[j] = 0;
    cout << v[j] << " ";
  }
  return 0;
}
