#include <bits/stdc++.h>
using namespace std;
const int size = 3e5 + 10;
int res[size];
int main() {
  int n = 0, m = 0;
  scanf("%d %d", &n, &m);
  set<int> preset;
  for (int i = 0; i < n; ++i) {
    preset.insert(i + 1);
  }
  for (int i = 0; i < m; ++i) {
    int l = 0, r = 0, x = 0;
    scanf("%d %d %d", &l, &r, &x);
    vector<int> del;
    for (set<int>::iterator it = preset.lower_bound(l); it != preset.end();
         ++it) {
      if (*it == l - 1 || *it == x) {
        continue;
      }
      if (*it > r) {
        break;
      }
      del.push_back(*it);
    }
    for (int i = 0; i < del.size(); ++i) {
      preset.erase(del[i]);
      res[del[i]] = x;
    }
  }
  for (int i = 1; i <= n; ++i) {
    printf("%d ", res[i]);
  }
  return 0;
}
