P29729 [洛谷] [COCI2015-2016#2] ARTUR
提高-
题目描述

Problem Description

There are $n$ sticks placed on a table. Determine an order in which the sticks can be moved towards the edge of the table along the $x$-axis without colliding (all sticks move towards the edge at the same speed).

Input Format

The first line contains an integer $N$, representing the total number of sticks.

The following $N$ lines each contain four integers $x1_i, y1_i, x2_i, y2_i$, representing the coordinates of the two ends of a stick.

Output Format

A single line containing $n$ integers, representing the valid order in which the sticks can be moved.

Sample Input and Output

Sample Input #1

4
1 3 2 2
1 1 3 2
2 4 7 3
3 3 5 3

Sample Output #1

2 4 1 3

Sample Input #2

4
0 0 1 1
1 2 0 3
2 2 3 3
4 0 3 1

Sample Output #2

4 3 1 2

Sample Input #3

3
4 6 5 5
2 1 15 1
3 2 8 7

Sample Output #3

2 3 1

Notes

[Sample 1 Explanation]

As shown in the figure, another valid order is 2 1 4 3.

Image

[Data Range]

For 40% of the data, $1 \le N \le 10$;

For 60% of the data, $1 \le N \le 300$;

For 100% of the data, $1 \le N \le 5000$, $0 \le x1, y1, x2, y2 \le 10^4$.

[Note]

This problem is sourced from COCI 2015-2016 CONTEST #2 T3 ARTUR.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 1 3 2 2 1 1 3 2 2 4 7 3 3 3 5 3
样例输出
2 4 1 3