#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e6 + 3;
const double PI = acos(-1);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<long long> killed(n + 1);
  set<int> alive;
  for (int i = 1; i <= n; i++) {
    alive.insert(i);
  }
  for (int i = 0; i < m; i++) {
    int a, b, w;
    cin >> a >> b >> w;
    auto pos = alive.lower_bound(a);
    vector<long long> vis;
    while (pos != alive.end() && *pos <= b) {
      int sol = *pos;
      if (sol != w && !killed[sol]) {
        vis.push_back(sol);
        killed[sol] = w;
      }
      pos++;
    }
    for (int i = 0; i < vis.size(); i++) {
      alive.erase(vis[i]);
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << killed[i] << ' ';
  }
  return 0;
}
