#include <bits/stdc++.h>
using namespace std;
const int N = 3 * 1e5 + 5;
int n, m;
int per[N];
set<int> alive;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) alive.insert(i);
  for (int i = 0; i < m; i++) {
    int l, r, x;
    scanf("%d%d%d", &l, &r, &x);
    set<int>::iterator it = alive.lower_bound(l);
    vector<int> defeated;
    while (it != alive.end()) {
      int val = *it;
      if (val > r) break;
      if (val != x) {
        defeated.push_back(val);
        per[val] = x;
      }
      it++;
    }
    for (unsigned int j = 0; j < defeated.size(); j++) alive.erase(defeated[j]);
  }
  for (int i = 1; i <= n; i++) printf("%d ", per[i]);
}
