- Time limit: 1.00 s
- Memory limit: 512 MB
There are line segments whose endpoints have integer coordinates. The left x-coordinate of each segment is and the right x-coordinate is . The slope of each segment is an integer.
For each x-coordinate , find the maximum point in any line segment.
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 two integers and : there is a line segment between points and .
Output
Print integers: the maximum points for .
Constraints
Example
Input:
4 5 1 6 7 2 5 5 10 0
Output:
10 8 6 5 5 6