#include <iostream>
#include<algorithm>
#include <cstring>
using namespace std;
struct key
{
int num;
int begin;
};
struct key22
{
int num;
int end;
};
bool cmp1(key a, key b)
{
return a.begin<b.begin;
}
bool cmp2(key22 a,key22 b)
{
if(a.end!=b.end)return a.end<b.end;
else return a.num<b.num;
}
struct key key1[1005];
struct key22 key2[1005];
int cont[1005];
int main()
{
int n,k;
cin>>n>>k;
memset(cont,0,sizeof(cont));
for(int i = 0;i<n;i++)
cont[i] = i+1;
for(int i = 0;i<k;i++ )
{
cin>>key1[i].num>>key1[i].begin;
int temp;
cin>>temp;
key2[i].num = key1[i].num;
key2[i].end = key1[i].begin+temp;
}
sort(key1,key1+k,cmp1);
sort(key2,key2+k,cmp2);
for(int i=0,j=0;;)
{
if(i>=k&&j>=k)break;
if(key1[i].begin<key2[j].end&&i<k)
{
for (int t = 0; t < n; t++)
{
if (cont[t] == key1[i].num)
{
cont[t] = 0;
break;
}
}
i++;
}
else
{
for (int t = 0; t < n; t++)
{
if (cont[t] == 0)
{
cont[t] = key2[j].num;
break;
}
}
j++;
}
}
for(int i = 0;i<n;i++)cout<<cont[i]<<" ";
return 0;
}