#include using namespace std; using ll = long long; const ll MOD = 1000000000; using P = pair; #define rep(i, n) for(int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() int main(){ int n,q; bool B = false; cin >> n >> q; vector> x(n+1); vector ans(n); rep(i,q){ int l,r,b; cin >> l >> r >> b; l--; x[l].push_back(make_pair(b,1)); x[r].push_back(make_pair(b,0)); } map> mp; rep(i,n){ for(auto now : x[i]){ int y,z; tie(y,z) = now; if(z){ mp[y].first++; mp[y].second = false; } else{ if(!mp[y].second) B = true; mp[y].first--; } if(!mp[y].first) mp.erase(y); } if(mp.size()){ auto it = max_element(all(mp)); ans[i] = (*it).first; (*it).second.second = true; } else ans[i] = MOD; } if(B) cout << -1; else rep(i,n) cout << ans[i] << " "; cout << endl; return 0; }