#include <bits/stdc++.h>
using namespace std;
int fastio() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  cin.tie(nullptr);
  return 0;
}
int __fastio = fastio();
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
void solve() {
  int n, m;
  cin >> n >> m;
  vector<int> res(n + 1);
  set<int> alive;
  for (int i = 1; i <= n; i++) alive.insert(i);
  vector<tuple<int, int, int>> events;
  for (int i = 0; i < m; i++) {
    int l, r, x;
    cin >> l >> r >> x;
    events.emplace_back(l, r, x);
  }
  for (auto [l, r, x] : events) {
    auto lb = alive.lower_bound(l);
    vector<int> killed;
    while (lb != alive.end() && *lb <= r) {
      killed.push_back(*lb);
      ++lb;
    }
    for (auto &k : killed) {
      if (k != x) {
        res[k] = x;
        alive.erase(k);
      }
    }
  }
  for (int i = 1; i <= n; i++) cout << res[i] << " ";
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
}
