Trading

Each trader covers villages L to R with a price that rises by 1 per village, and each village reports the highest price ever asked there.

Medium4Segment treeIntervalsInterviewNo attempts yetTime limit2sMemory limit64 MB

Problem

There are NN villages beside the highway between Almaty and Taraz, numbered 1 to NN. When winter began, MM traders started selling knitted hats in these villages. Every trader keeps two rules: he trades in one village for a single day, and he raises his price every day.

Trader ii behaves like this.

  1. He starts trading in village LiL_i at price XiX_i.
  2. Every day he moves to the next village. If he traded in village jj yesterday, he trades in village j+1j+1 today.
  3. Every day he raises the price by 1. If yesterday's price was xx, today's price is x+1x+1.
  4. He stops once he has sold his hats in village RiR_i.

For each village, find the highest price that was ever asked there.

Input

The first line contains the number of villages NN and the number of traders MM (1N3000001 \le N \le 300000, 1M3000001 \le M \le 300000).

Each of the next MM lines contains three integers LiL_i, RiR_i, XiX_i (1LiRiN1 \le L_i \le R_i \le N, 1Xi1091 \le X_i \le 10^9): the first village, the last village, and the starting price of trader ii, in that order.

Output

Print NN integers on one line, separated by single spaces. The ii-th number is the highest price ever asked in village ii. Print 0 for a village where nobody traded.