#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 10; int n,m,fa[maxn],col[maxn]; int find(int x){ return fa[x] == x ? x : fa[x] = find(fa[x]); } void merge(int l,int r,int x){ while(l <= r){ if(find(l) == l){ col[l] = x; //=x,运行超时 fa[l] = l + 1; } l = fa[l]; } } int main(){ //freopen("in","r",stdin); ios::sync_with_stdio(0); cin >> n >> m; //如果要是n的话,内存超限 for(int i = 1; i <= n + 1; i++) fa[i] = i; for(int i = 1; i <= m; i++){ int l,r,x; cin >> l >> r >> x; merge(l, x - 1,x); merge(x + 1,r,x); } for(int i = 1; i <= n; i++){ if(i == 1) cout << col[i]; else cout << " " << col[i]; } return 0; }