#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  set<int> win;
  int A[n];
  for (int i = 0; i < n; ++i) win.insert(i), A[i] = i;
  for (int i = 0; i < k; ++i) {
    vector<int> lose;
    int a, b, c;
    cin >> a >> b >> c;
    --a, --b, --c;
    auto it = win.lower_bound(a);
    while (it != win.end()) {
      if (*it > b) break;
      if (*it != c) {
        lose.push_back(*it);
      }
      it++;
    }
    for (auto i : lose) {
      win.erase(i);
      A[i] = c;
    }
  }
  for (int i = 0; i < n; ++i) {
    if (A[i] == i)
      cout << 0 << " ";
    else
      cout << A[i] + 1 << " ";
  }
}
