There are $N$ buckets (1-indexed), all starting at $0$. Apply $M$ operations, each i j v which sets every bucket in positions $[i, j]$ to $v$ (overwriting). Print the final bucket values, space-separated.
Input
Line 1: $N$ $M$. Next $M$ lines: i j v ($1 \le i \le j \le N$).
Output
Print the final $N$ bucket values.
Example 1
Input
5 4 1 2 3 3 4 4 1 4 1 2 2 2
Output
1 2 1 1 0
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.