#include <bits/stdc++.h>
using namespace std;
double PI = acos(-1.0);
int cs = 1, test;
int sol[300009], n, m;
set<int> st;
set<int>::iterator it;
vector<int> del;
int main() {
  int i, j, k, x, y, z, len, mx = -1;
  scanf("%d %d", &n, &m);
  for (i = 1; i <= n; i++) st.insert(i);
  for (i = 1; i <= m; i++) {
    scanf("%d %d %d", &x, &y, &z);
    it = st.lower_bound(x);
    del.clear();
    for (; *it <= y && it != st.end(); it++) {
      if (*it == z) continue;
      sol[*it] = z;
      del.push_back(*it);
    }
    for (j = 0; j < del.size(); j++) {
      st.erase(del[j]);
    }
  }
  sol[z] = 0;
  for (i = 1; i <= n; i++) printf("%d ", sol[i]);
  printf("\n");
  return 0;
}
