#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
const int inf = (1 << 30) - 1;
const ll INF = (1LL << 60) - 1;
template <typename T>
bool chmax(T &x, const T &y) {
  return (x < y) ? (x = y, true) : false;
};
template <typename T>
bool chmin(T &x, const T &y) {
  return (x > y) ? (x = y, true) : false;
};
struct io_setup {
  io_setup() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed << setprecision(15);
  }
} io_setup;
int main() {
  int N, Q;
  cin >> N >> Q;
  vector<int> ans(N, -1);
  set<int> s;
  for (int i = 0; i < N; i++) s.emplace(i);
  while (Q--) {
    int L, R;
    cin >> L >> R;
    L--;
    int x;
    cin >> x;
    x--;
    for (auto it = s.lower_bound(L); it != end(s) && *it < R;) {
      if (*it != x) {
        ans[*it] = x;
        it = s.erase(it);
      } else
        it++;
    }
  }
  for (int i = 0; i < N; i++) cout << ans[i] + 1 << (i == N - 1 ? '\n' : ' ');
}
