#include<iostream>#include<cstring>#include<algorithm>usingnamespace std;constint N =1010;int n, k;int w, s, c;struct pk //pick取钥匙的结构体数组{int num;int time;//开始借的时间booloperator<(const pk & t)const//根据时间从小到大排序{return time < t.time;}}p[N];struct bk //back还钥匙的结构体数组{int num;int time;//还钥匙的时间booloperator<(const bk & t)const{if(time == t.time)return num < t.num;//如果同一个时间多个老师还钥匙,编号小的钥匙先还elsereturn time < t.time;}}b[N];int a[N];intmain(){
cin >> n >> k;for(int i =1; i <= n; i ++){
a[i]= i;}for(int i =0; i < k; i ++){
cin >> w >> s >> c;
p[i]={w, s};
b[i]={w, s + c};}sort(p, p + k);sort(b, b + k);int pcnt =0, bcnt =0;for(int t =0; t <=10110; t ++){while(b[bcnt].time == t)//先处理t时刻还钥匙的所有事件{for(int i =1; i <= n; i ++){if(a[i]==-1){
a[i]= b[bcnt].num;break;}}
bcnt ++;}while(p[pcnt].time == t)//再处理t时刻借钥匙的所有事件{for(int i =1; i <= n; i ++){if(a[i]== p[pcnt].num){
a[i]=-1;break;}}
pcnt ++;}if(pcnt == k && bcnt == k)break;//所有事件均处理完}for(int i =1; i <= n; i ++){
cout << a[i]<<" ";}return0;}