#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 9;
set<int> s;
map<int, int> mp;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) s.insert(i);
  for (int j = 0; j < m; ++j) {
    int a, b, x;
    cin >> a >> b >> x;
    for (auto i = s.lower_bound(a); *i <= b && i != s.end();) {
      int temp = *i;
      if (s.find(temp) != s.end()) s.erase(temp);
      if (temp != x) mp[temp] = x;
      i = s.lower_bound(a);
    }
    s.insert(x);
  }
  for (int i = 0; i < n; ++i) cout << mp[i + 1] << " ";
  return 0;
}
