#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double SQRT2 = 1.41421356237;
const double EPS = 1e-9;
const float SQRT2F = (float)SQRT2;
const int INF = 100500;
template <class T>
T sqr(const T &x) {
  return x * x;
}
template <class T>
T min(const T &a, const T &b, const T &c) {
  return min(min(a, b), c);
}
template <class T>
T max(const T &a, const T &b, const T &c) {
  return max(max(a, b), c);
}
inline void yesno(bool y) { cout << (y ? "YES\n" : "NO\n"); }
inline void yes_stop(bool y) {
  if (y) {
    yesno(1);
    exit(0);
  }
}
inline void no_stop(bool y) {
  if (!y) {
    yesno(0);
    exit(0);
  }
}
int n, m;
set<int> a;
int p[300500];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) a.insert(i);
  for (int i = 0; i < m; ++i) {
    int l, r, w;
    cin >> l >> r >> w;
    auto L = a.lower_bound(l);
    auto R = a.upper_bound(r);
    for (auto it = L; it != R;) {
      if (*it == w) {
        ++it;
      } else {
        p[*it] = w;
        it = a.erase(it);
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << p[i] << " ";
  }
  cout << endl;
  return 0;
}
