#include <bits/stdc++.h>
using namespace std;
const int INF = (int)2e9;
int ans[1000009];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  set<int> left;
  for (int i = 1; i <= n; ++i) left.insert(i);
  for (int i = 0; i < m; ++i) {
    int l, r, x;
    scanf("%d %d %d", &l, &r, &x);
    set<int>::iterator low = left.lower_bound(l);
    vector<int> del;
    for (set<int>::iterator it = low; it != left.end(); it++) {
      int val = *it;
      if (val > r) break;
      if (val == x) continue;
      del.push_back(val);
      ans[val] = x;
    }
    for (int i = 0; i < del.size(); ++i) left.erase(del[i]);
  }
  for (int i = 1; i <= n; ++i) printf("%d ", ans[i]);
}
