Wall

No attempts yetTime limit3sMemory limit256 MB

Problem

Gianina builds a wall of nn columns of equal bricks. Columns are numbered 00 through n1n-1 from left to right. The height of a column is its brick count.

Initially every column has height 0. Over kk steps, each step gives an inclusive column range [left,right][\text{left}, \text{right}] and a height hh.

  • Add (op=1): within the range, any column shorter than hh receives bricks until its height is exactly hh. Columns already at least hh stay unchanged.
  • Remove (op=2): within the range, any column taller than hh loses bricks until its height is exactly hh. Columns already at most hh stay unchanged.

After all steps, output the final brick count in each column.

Input

Line 1: nn, kk.

Next kk lines: op left right height

  • op=1 add, op=2 remove
  • left, right: inclusive range (0leftright<n0 \le \text{left} \le \text{right} < n)
  • height: target height

Output

Print the final brick count of each column, one per line from left to right.