#include <bits/stdc++.h>
using namespace std;
const int N = 2 * 1e6;
int winner, tree[N];
template <typename T>
class segment {
 public:
  void update(int nodo, int start, int end, int l, int r, int x) {
    if (start > r || end < l) return;
    if (tree[nodo]) return;
    if (l <= start && end <= r) {
      tree[nodo] = x;
      return;
    } else {
      int mid = (start + end) / 2;
      update(nodo * 2, start, mid, l, r, x);
      update(nodo * 2 + 1, mid + 1, end, l, r, x);
    }
  }
  void answer(int nodo, int start, int end) {
    if (start == end) {
      cout << tree[nodo] << ' ';
      return;
    } else {
      if (!tree[nodo * 2]) tree[nodo * 2] = tree[nodo];
      if (!tree[nodo * 2 + 1]) tree[nodo * 2 + 1] = tree[nodo];
      int mid = (start + end) / 2;
      answer(nodo * 2, start, mid);
      answer(nodo * 2 + 1, mid + 1, end);
    }
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, a, b, l1, l2, r1, r2;
  cin >> n >> m;
  segment<int> tr;
  while (m--) {
    cin >> a >> b >> winner;
    if (a == b) continue;
    if (a == winner) {
      l1 = a + 1;
      r1 = b;
      tr.update(1, 1, n, l1, r1, winner);
    } else if (b == winner) {
      l1 = a;
      r1 = b - 1;
      tr.update(1, 1, n, l1, r1, winner);
    }
    if (a < winner) {
      l1 = a;
      r1 = winner - 1;
      l2 = winner + 1;
      r2 = b;
      tr.update(1, 1, n, l1, r1, winner);
      tr.update(1, 1, n, l2, r2, winner);
    }
  }
  tr.answer(1, 1, n);
}
