#include<iostream>
#include<algorithm>
using namespace std;
struct Key
{
int key;
int time;
int operation;
}Op[2000];
bool cmp(Key key1, Key key2)//
{
if (key1.time != key2.time)
{
return key1.time < key2.time;
}
else if(key1.operation==key2.operation)
{
return key1.key < key2.key;
}
else
{
return key1.operation > key2.operation;
}
}
int main()
{
int N, K;
cin >> N >> K;
int arr[1000];
for (int i = 1; i <= N; i++)
{
arr[i] = i;
}
int count = 0;
for (int i = 0; i < K; i++)
{
int key, start, end;
cin >> key >> start >> end;
Op[count].key = key;
Op[count].time = start;
Op[count].operation = 0;
count++;
Op[count].key = key;
Op[count].time = start + end;
Op[count].operation = 1;
count++;
}
sort(Op, Op + 2 * K, cmp);
for (int i = 0; i < 2 * K; i++)
{
if (Op[i].operation == 0)
{
for (int j = 1; j <=N; j++)
{
if (arr[j] == Op[i].key)
{
arr[j] = -1;
break;
}
}
}
else if (Op[i].operation == 1)
{
for (int j = 1; j <= N; j++)
{
if (arr[j] == -1)
{
arr[j] = Op[i].key;
break;
}
}
}
}
for (int i = 1; i <= N; i++)
{
cout << arr[i] << " ";
}
cout << endl;
}