#include <bits/stdc++.h>
using namespace std;
double PI = acos(-1);
double EPS = 1e-7;
int INF = 1000000000;
int MOD = 1000000007;
int MAXINT = 2147483647;
long long INFLL = 1000000000000000000LL;
long long MAXLL = 9223372036854775807LL;
set<int> st;
set<int>::iterator it;
int ans[300005];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int(a) = (1); (a) <= (n); (a)++) st.insert(a);
  for (int(a) = (1); (a) <= (m); (a)++) {
    int l, r, x, ls;
    scanf("%d%d%d", &l, &r, &x);
    ls = l;
    while (1) {
      it = st.lower_bound(ls);
      if (it == st.end()) break;
      if ((*it) > r) break;
      ls = (*it) + 1;
      if ((*it) != x) {
        ans[(*it)] = x;
        st.erase((*it));
      }
    }
  }
  for (int(a) = (1); (a) <= (n); (a)++) {
    printf("%d ", ans[a]);
  }
  puts("");
}
