#include using namespace std; #include using namespace atcoder; #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i, n) for (ll i = 1; i <= n; ++i) #define reps(i, s, e) for (ll i = s; i <= e; ++i) #define all(v) v.begin(), v.end() using ll = long long; using ld = long double; using cp = complex; using pa = pair; using tup = tuple; using vp = vector>; using vtup = vector>; using st = string; using vs = vector; using vc = vector; using vvi = vector>; using vvc = vector>; using vi = vector; const ll MOD1 = 1000000007; const ll MOD2 = 998244353; const ll INF = (1LL << 60); int main() { ll n, q; cin >> n >> q; vector> query(q); rep(i, q) { ll l, r, b; cin >> l >> r >> b; l--; query[i] = {b, l, r}; } sort(all(query)); reverse(all(query)); ll prev = -1; vi tmp(n); iota(all(tmp), 0); set unused(all(tmp)); set used_by_b; vi ans(n); for (auto [b, l, r] : query) { if (b != prev) { prev = b; used_by_b.clear(); } auto itr = unused.lower_bound(l); if (itr == unused.end() || *itr >= r) { auto itr2 = used_by_b.lower_bound(l); if (itr2 == used_by_b.end() || *itr2 >= r) { cout << -1 << endl; return 0; } } else { while (itr != unused.end() && *itr < r) { ans[*itr] = b; used_by_b.insert(*itr); itr = unused.erase(itr); } } } for (auto i : unused) ans[i] = INF; rep(i, n) { cout << ans[i]; if (i == n - 1) { cout << endl; } else { cout << " "; } } return 0; }