Petya studies at university. The current academic year finishes with n
.
There are three values about each exam:
- si
- , inclusive.
There are three types of activities for Petya in each day: to spend a day doing nothing (taking a rest), to spend a day passing exactly one exam or to spend a day preparing for exactly one exam. So he can't pass/prepare for multiple exams in a day. He can't mix his activities in a day. If he is preparing for the i
-th exam in day j, then si≤j<di.
It is allowed to have breaks in a preparation to an exam and to alternate preparations for different exams in consecutive days. So preparation for an exam is not required to be done in consecutive days.
Find the schedule for Petya to prepare for all exams and pass them, or report that it is impossible.
The first line contains two integers n
— the number of days and the number of exams.
Each of the following m
lines contains three integers si, di, ci (1≤si<di≤n,1≤ci≤n) — the day, when questions for the i-th exam will be given, the day of the i-th exam, number of days Petya needs to prepare for the i-th exam.
Guaranteed, that all the exams will be in different days. Questions for different exams can be given in the same day. It is possible that, in the day of some exam, the questions for other exams are given.
If Petya can not prepare and pass all the exams, print -1. In case of positive answer, print n
-th number is:
- (m+1)
Assume that the exams are numbered in order of appearing in the input, starting from 1
.
If there are multiple schedules, print any of them.
5 2 1 3 1 1 5 1
1 2 3 0 3
3 2 1 3 1 1 2 1
-1
10 3 4 7 2 1 10 3 8 9 1
2 2 2 1 1 0 4 3 4 4
In the first example Petya can, for example, prepare for exam 1