#include <bits/stdc++.h>
using namespace std;
struct edje {
  int from, to;
  long long w;
  edje(int from, int to, long long w) : from(from), to(to), w(w) {}
  bool operator<(const edje& e) const { return w < e.w; }
};
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
const long long oo = (long long)((1e18) + 1);
const double eps = 1e-9;
const long long mod = 1000000007;
string getstr(long long x) {
  stringstream ss;
  ss << x;
  string str = ss.str();
  return str;
}
int main(void) {
  int n, m;
  cin >> n >> m;
  int li[m], ri[m], xi[m];
  int vis[n + 1];
  memset(vis, 0, sizeof(vis));
  set<int> k;
  for (int i = 1; i <= n; i++) k.insert(i);
  for (int i = 0; i < (int)(m); ++i) {
    cin >> li[i] >> ri[i] >> xi[i];
    set<int>::iterator it = k.lower_bound(li[i]);
    vector<int> togo;
    while (it != k.end()) {
      int c = *it;
      if (c > ri[i]) break;
      if (c != xi[i]) {
        togo.push_back(c);
        vis[c] = xi[i];
      }
      it++;
    }
    for (size_t j = 0; j < togo.size(); j++) k.erase(togo[j]);
  }
  for (int i = (1); i < (int)(n + 1); ++i) {
    if (i == xi[m - 1])
      cout << "0 ";
    else
      cout << vis[i] << " ";
  }
}
