Larry is collecting buckets of water. He has (
) buckets in a line, each starting empty and having a capacity of
(
). Every once in a while, someone comes to pour some water in a continuous segment of buckets, pouring the same amount of water in each bucket.
Larry wants to know when each bucket will overflow.
Input Specification
The first line of input will consist of three integers:
and
, indicating that
pours happpened.
The next lines of input will each consist of three integers,
,
and
, indicating someone poured
water into buckets in segment
.
Output Specification
The output should consist of space separated integers, the
th integer indicating that the
th bucket was filled after the
th pour (starting at 1).
If a bucket is never filled, output instead.
Subtasks
Subtask 1 (10%)
Subtask 2 (90%)
No further constraints.
Sample Input
3 3 1
1 2 3
Sample Output
1 1 -1
Comments