#include #define rep(i, n) for (int i = 0; i < n; ++i) typedef long long ll; using namespace std; int main() { int N, Q; cin >> N >> Q; vector> vt(Q); rep(i, Q) { int l, r, b; cin >> l >> r >> b; l--, r--; vt[i] = {l, -r, b}; } sort(vt.begin(), vt.end()); int i = 0; vector ans(N, 1e9); for (auto &[l, r, b] : vt) { r = -r; bool flag = false; for (int j = max(l, i); j <= r; ++j) { i++; if (ans[j] > b) { ans[j] = b; flag = true; break; } } if (!flag) { cout << -1 << endl; return 0; } } rep(i, N) { if (i != 0) cout << " "; cout << ans[i]; } cout << endl; return 0; }