#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long long int INF = 1e18;
const int N = 100005;
const int MOD = 1e9 + 7;
const double EPS = 1e-6;
const double PI = acos(-1.0);
int tree[3 * 4 * N];
int ans[3 * N] = {0};
void update(int node, int b, int e, int i, int j, int winner) {
  if (i > e || j < b || tree[node] == inf) return;
  if (b == e) {
    if (b == winner) return;
    tree[node] = inf;
    ans[b] = winner;
    return;
  }
  int left = 2 * node;
  int right = 2 * node + 1;
  int mid = (b + e) / 2;
  update(left, b, mid, i, j, winner);
  update(right, mid + 1, e, i, j, winner);
  tree[node] = min(tree[left], tree[right]);
}
int main(int argc, char const *argv[]) {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int l, r, winner;
    scanf("%d%d%d", &l, &r, &winner);
    update(1, 1, n, l, r, winner);
  }
  for (int i = 1; i <= n; i++) {
    printf("%d ", ans[i]);
  }
  return 0;
}
