#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000000000")
using namespace std;
const int INF = 2e8;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> out(n, -1);
  set<int> good;
  for (int i = 0; i < n; i++) {
    good.insert(i);
  }
  for (int i = 0; i < m; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    a--;
    b--;
    c--;
    set<int>::iterator it = good.lower_bound(a), del;
    while (it != good.end() && *it <= b) {
      if (c == *it) {
        it++;
        continue;
      }
      out[*it] = c;
      del = it++;
      good.erase(del);
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", out[i] + 1);
  }
}
