Problem G. Game with rectangles

Author:A. Baranov   Time limit:1 sec
Input file:Standard input   Memory limit:256 Mb
Output file:Standard output  

Statement

Vasya writes a 2D game engine. One of the tasks is to determine parts of the scene visible by the gamer from a given position.

Let us consider a set of rectangles with sides parallel to the coordinate axes: Pi = {(x, y): ai ≤ x ≤ bi, ci ≤ y ≤ di}.

Rectangle Pi is visible from the point A, if there exists some point B ∈ Pi such that segment AB does not contain points belonging to other rectangles.

Your program must determine indices of rectangles that are visible from the point (0, 0).

Input format

Input contains integer n followed by 4 × n integers: ai, bi, ci and di.

Output format

Output must contain indices of visible rectangles in ascending order. Indices start from 0.

Constraints

Rectangles do not intersect each other and do not contain point (0, 0).

2 ≤ n ≤ 105

 − 106 ≤ ai ≤ bi ≤ 106

 − 106 ≤ ci ≤ di ≤ 106

Sample tests

No. Standard input Standard output
1
5
-3  3 -2 -1
 2  8  4  6 
 1  4  2  3
-4 -1  2  8
 1  7 -5 -3
0
2
3
2
5
 0  4  3  7
-1  2  1  2 
 1  5 -3 -2
 0  0 -6 -5
 0  0 -4 -2
1
2
4

0.091s 0.007s 15