#include <bits/stdc++.h>
using namespace std;
long long Move[8][2] = {{0, 1}, {1, 0},  {0, -1}, {-1, 0},
                        {1, 1}, {-1, 1}, {1, -1}, {-1, -1}};
void sync() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
unsigned long long dp[2000][2000];
int arr[2000];
void _new() {
  memset(dp, -1, sizeof(dp));
  memset(arr, 0, sizeof(arr));
  return;
}
int main() {
  int n, m;
  cin >> n >> m;
  set<int> s;
  for (int i = 0; i < n; i++) {
    s.insert(i + 1);
  }
  int won[n + 10];
  memset(won, 0, sizeof(won));
  for (int i = 0; i < m; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    set<int>::iterator it = s.lower_bound(a);
    while ((*it) <= b && s.size() > 1 && it != s.end()) {
      if ((*it) != c) {
        set<int>::iterator temp = it;
        temp++;
        won[(*it)] = c;
        s.erase((*it));
        it = temp;
      } else {
        it++;
      }
    }
  }
  for (int i = 1; i <= n; i++) cout << won[i] << " ";
}
