#include using namespace std; #define endl "\n" #define all(v) v.begin(), v.end() const int N = 2e5 + 10; int n,q; int main() { scanf("%d %d",&n,&q); vector> query(q); set unused; set used; vector ans(n); for(int i = 0;i < n;i ++ ) unused.insert(i); for(int i = 0;i < q;i ++ ) { int l,r,b; scanf("%d %d %d",&l,&r,&b); l --, r --; query[i] = {b,l,r}; } sort(all(query)); reverse(all(query)); int prev = -1; for(auto [b,l,r] : query) { if(b != prev) { prev = b; used.clear(); } auto itr = unused.lower_bound(l); if(itr == unused.end() || *itr > r) { auto itr2 = used.lower_bound(l); if(itr2 == used.end()) { cout << "-1" << endl; return 0; } } else { while(itr != unused.end() && *itr <= r) { ans[*itr] = b; used.insert(*itr); itr = unused.erase(itr); } } } for(auto i : unused) ans[i] = int(1e9); for(int i = 0;i < n;i ++ ) cout << ans[i] << " \n"[i == n - 1]; return 0; }