#include <bits/stdc++.h>
using namespace std;
int cab, peleas;
int main() {
  cin >> cab >> peleas;
  set<int> vivos;
  vector<int> killed(cab + 1);
  for (int x = 1; x <= cab; x++) {
    vivos.insert(x);
  }
  for (int x = 0; x < peleas; x++) {
    int a, b, c;
    cin >> a >> b >> c;
    auto s = vivos.lower_bound(a);
    while (*s <= b and s != vivos.end()) {
      if (*s == c) {
        s++;
        continue;
      }
      killed[*s] = c;
      auto t = s;
      t++;
      vivos.erase(s);
      s = t;
    }
  }
  for (int s = 1; s <= cab; s++) {
    cout << killed[s] << " ";
  }
}
