319. Kalevich Strikes Back
Time limit per test: 0.5
Memory limit: 65536
And yet again the Berland community can see that talent is always multi-sided. The talent is always seeking new ways of self-expression. This time genius Kalevich amazed everybody with his new painting "Rectangular Frames". The masterpiece is full of impenetrable meaning and hidden themes.
Narrow black rectangular frames are drawn on a white rectangular canvas. No two frames have a common point. Sides of each frame are parallel to the sides of the canvas.
The painting is very big and the reduced replica cannot pass the idea of the original drawing. That's why Kalevich requested that the simplified versions of the masterpiece should be used as replicas. The simplified version is the sequence of the areas of all facets of the original. A facet is a connected enclosed white area within the painting. The areas in the sequence should be written in the non-decreasing order.
The first line of the input contains an integer N
(1 ≤ N
≤ 60000) — the number of the frames on the drawing. The second line contains integer numbers W
(1 ≤ W
Let's introduce the Cartesian coordinate system in such a way that the left bottom corner of the canvas has (0, 0) coordinate and the right top corner has the (W
) coordinate. The sides of the canvas are parallel to the axes.
The following N
lines contain the description of the frames. Each description is composed of the coordinates of the two opposite corners of the corresponding frame x1
(1 ≤ x1
; 1 ≤ y1
). All coordinates are integers. No two frames have a common point.
Write the desired sequence to the output.
2 1 1 2