#include <bits/stdc++.h>
using namespace std;
int result[2000000];
set<int> myset;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) myset.insert(i);
  for (int i = 0; i < m; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    auto here = myset.lower_bound(a);
    while (here != myset.end() and *here <= b) {
      if (*here != c) {
        result[*here] = c;
        auto it = here;
        here++;
        myset.erase(it);
      } else
        here++;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (result[i] == i)
      cout << 0 << " ";
    else
      cout << result[i] << " ";
  }
  return 0;
}
