#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const double eps = 1e-8;
const int maxn = 300010;
int sgn(const double &x) { return (x > eps) - (x < -eps); }
set<int> Left;
vector<int> temp;
int p[maxn];
int main() {
  int n, m;
  while (scanf("%d%d", &n, &m) == 2) {
    Left.clear();
    for (int i = (1); i <= (n); ++i) Left.insert(i);
    memset(p, 0, sizeof(p));
    for (int i = (1); i <= (m); ++i) {
      int a, b, c;
      scanf("%d%d%d", &a, &b, &c);
      set<int>::iterator it = Left.lower_bound(a);
      for (; *it <= b && it != Left.end(); it++) {
        if (*it != c) {
          p[*it] = c;
          temp.push_back(*it);
        }
      }
      for (int j = (0); j < (temp.size()); ++j) Left.erase(temp[j]);
      temp.clear();
    }
    for (int i = (1); i <= (n); ++i)
      if (p[i] == i) p[i] = 0;
    cout << p[1];
    for (int i = (2); i <= (n); ++i) printf(" %d", p[i]);
    cout << endl;
  }
  return 0;
}
