#include <bits/stdc++.h>
using namespace std;
int Next[300005], Res[300005];
int N, M;
void setArray() {
  for (int i = 0; i <= N; i++) {
    Next[i] = i + 1;
    Res[i] = 0;
  }
}
int NextKnight(int cur, int xi) {
  if (cur == xi) return xi;
  if (Res[cur] == 0)
    return cur;
  else {
    Next[cur] = NextKnight(Next[cur], xi);
    return Next[cur];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N >> M;
  setArray();
  int li, ri, xi;
  for (int i = 0; i < M; i++) {
    cin >> li >> ri >> xi;
    while (true) {
      if (li != xi)
        li = NextKnight(li, xi);
      else
        li = NextKnight(Next[li], xi);
      if (li <= ri) {
        if (li != xi) Res[li] = xi;
      } else
        break;
    }
  }
  for (int i = 1; i <= N; i++) {
    cout << Res[i] << " ";
  }
  return 0;
}
