- Time limit: 1.00 s
- Memory limit: 512 MB
There are line segments whose endpoints have integer coordinates. Each x-coordinate is between and . The slope of each segment is an integer.
For each x-coordinate , find the maximum point in any line segment. If there is no segment at some point, the maximum is .
Input
The first line has two integers and : the number of line segments and the maximum x-coordinate.
The next lines describe the line segments. Each line has four integers , , and : there is a line segment between points and .
Output
Print integers: the maximum points for .
Constraints
Example
Input:
4 5 1 1 3 3 1 2 4 2 2 4 5 7 2 8 5 2
Output:
-1 2 8 6 6 7