#include <bits/stdc++.h>
using namespace std;
long long expo(long long a, long long b, long long m) {
  long long result = 1;
  while (b) {
    if (b & 1) {
      result = (result * a) % m;
    }
    b = (b >> 1) % m;
    a = (a * a) % m;
  }
  return result;
}
double expof(double a, int b) {
  double result = 1;
  while (b) {
    if (b & 1) {
      result = (result * a);
    }
    b = (b >> 1);
    a = (a * a);
  }
  return result;
}
bool comp(long long a, long long b) { return a > b; }
int isdiv2(long long n) {
  if (n % 2 == 1)
    return 0;
  else {
    long long temp = 2, i = 0;
    while (n % temp == 0) {
      i++, temp *= 2;
    }
    return i;
  }
}
long long n, m, a1, b1, x;
long long b[300005] = {0};
int main() {
  cin >> n >> m;
  set<int> s;
  for (int i = 1; i <= n; ++i) {
    s.insert(i);
  }
  for (int i = 0; i < m; ++i) {
    scanf("%lld %lld %lld", &a1, &b1, &x);
    set<int>::iterator it = s.lower_bound(a1);
    vector<int> v;
    for (; it != s.end() && (*it) <= b1;) {
      if ((*it) == x) {
        it++;
        continue;
      } else {
        int temp = *it;
        it++;
        b[temp] = x;
        v.push_back(temp);
      }
    }
    int n1 = v.size();
    for (int j = 0; j < n1; ++j) {
      s.erase(v[j]);
    }
  }
  for (int i = 1; i <= n; i++) printf("%lld ", b[i]);
}
