#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 5;
const ll INF = 1e18 + 1;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  set<int> s;
  for (int i = 0; i < n; i++) s.insert(i);
  vector<int> ans(n + 1);
  for (int i = 0; i < m; i++) {
    int l, r, win;
    cin >> l >> r >> win;
    l--;
    r--;
    win--;
    auto it = s.lower_bound(l);
    vector<int> temp;
    while (it != s.end()) {
      int cur = *it;
      if (cur > r) break;
      if (cur != win) {
        temp.emplace_back(cur);
        ans[cur] = win + 1;
      }
      it++;
    }
    for (size_t j = 0; j < temp.size(); j++) s.erase(temp[j]);
  }
  for (int i = 0; i < ans.size() - 1; i++) cout << ans[i] << " ";
  return 0;
}
