Contests | Virtual Contests | Problems | Submit | Runs Status | Rank List | Forum |

Time Limit: 1.0 Seconds Memory Limit: 65536K

Total Runs: 1273 Accepted Runs: 397

You must be very familiar with the game "Tetris". Now we consider a simplified version of this game. In this version, all the blocks are rectangle, and you even can't move the blocks horizontally when they are falling. ### Input

The first line of each test case contains the number of the blocks *N* and the width of the game arena *W*. Then *N* lines following. Each contains three integers *S*_{i}, *E*_{i}, *H*_{i}, which means the block's horizontal position is the interval [*S*_{i}, *E*_{i}] and the height of the block is *H*_{i}.### Output

Output one number for each test case, containing the maximum height. ### Sample Input

### Sample Output

**Hint:** The figure below describes the sample case.

Given the description of the blocks series, which contains the horizontal position and the height of each block. You are requested to calculate the maximum height when all the blocks are landed by the given order.

You can assume *W* ≤ 10^{9}, *N* ≤ 1000, 1 ≤ *S _{i}* ≤

The input is terminated with *W* = *N* = 0.

3 10 1 3 2 3 4 5 6 7 6 0 0

7

Maintance:G.D.Retop. Developer: SuperHacker, G.D.Retop