#include <bits/stdc++.h>
using namespace std;
const int OO = 0x3f3f3f3f;
using namespace std;
long long inv(long long a, long long b) {
  return 1 < a ? b - inv(b % a, a) * b / a : 1;
}
long long Pow(long long B, long long P) {
  long long R = 1;
  while (P > 0) {
    if (P & 1) R = (R * B);
    P /= 2;
    B = (B * B);
  }
  return R;
}
long long GCD(long long a, long long b) {
  while (b) {
    b ^= a ^= b ^= a %= b;
  }
  return a;
}
long long LCM(long long a, long long b) { return (a / GCD(a, b) * b); }
long long BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P & 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return (long long)R;
}
vector<int> ans;
set<int> alive;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n;
  ans.resize(n, 0);
  for (long long i = 0; i < n; ++i) alive.insert(i);
  cin >> m;
  for (long long i = 0; i < m; ++i) {
    int from, to, winner;
    cin >> from >> to >> winner;
    --from;
    --to;
    --winner;
    set<int>::iterator it = alive.lower_bound(from);
    vector<int> tormv;
    while (it != alive.end()) {
      int cur = *it;
      if (cur > to) break;
      if (cur != winner) {
        tormv.push_back(cur);
        ans[cur] = winner + 1;
      }
      ++it;
    }
    for (int x : tormv) alive.erase(x);
  }
  for (int x : ans) cout << x << " ";
  return 0;
}
