P7860 [COCI 2015/2016 #2] ARTUR

Description

There are $n$ sticks placed on a tabletop. Find an order to move the sticks toward the edge of the table along the $x$ axis, such that the sticks do not collide (all sticks move toward the table edge at the same speed).

Input Format

The first line contains an integer $N$, the total number of sticks. The next $N$ lines each contain four integers $x1_i,y1_i,x2_i,y2_i$, representing the coordinates of the two endpoints of a stick.

Output Format

Output one line with $n$ integers, representing a valid order to move the sticks.

Explanation/Hint

**Sample 1 Explanation** As shown in the figure, another valid moving order is `2 1 4 3`. ![](https://cdn.luogu.com.cn/upload/image_hosting/6yeaxhnb.png) **Constraints** For $40\%$ of the testdata, $1\le N\le 10$. For $60\%$ of the testdata, $1\le N\le 300$. For $100\%$ of the testdata, $1\le N\le 5000$, $0\le x1,y1,x2,y2\le 10^4$. **Notes** The scoring of this problem follows the original problem, with a full score of 100. This problem is translated from **T3 ARTUR** of [COCI 2015-2016](https://hsin.hr/coci/archive/2015_2016/) [CONTEST #2](https://hsin.hr/coci/archive/2015_2016/contest2_tasks.pdf). Translated by ChatGPT 5