Puzzle
문제
Zigmas has a rectangular jigsaw puzzle of height and width . The puzzle consists of pieces. Each piece is constructed from rectangles of unit height stacked on one another. The pieces are shuffled, but neither rotated nor flipped.
Help Zigmas solve the puzzle by writing down how to order the pieces to get a perfect rectangle. The pieces can't be rotated or flipped, they can't overlap and there must be no gaps left.
입력
The first line contains two integers and (): the number of puzzle pieces and the puzzle height, respectively.
Each of the remaining lines contains integers: -st line describes the -th puzzle piece as (), where is the -coordinate of the left side and the -coordinate of the right side of the -th rectangle of the -th piece.
It is known that each puzzle piece is a connected figure ( and for all and ).
출력
Output distinct integers, each in the range : the numbers of the puzzle pieces in such an order that they form a perfect rectangle when laid out side by side. If there are several solutions, output any one of them. It is known that at least on soluton exists in each test case.
예제
예제 1
4 3 0 2 0 1 0 2 1 2 0 2 0 2 0 3 1 2 1 2 1 2 0 3 1 3
1 4 3 2
예제 2
5 2 1 3 2 3 0 1 0 2 0 3 1 2 0 2 1 3 1 2 0 3
2 3 5 4 1