eolymp
bolt
Try our new interface for solving problems
Problems

Falling cards

Falling cards

Time limit 1 second
Memory limit 64 MiB

It is hard to make the playing card stand on its edge, however, some patient person managed to put N of them upon the desk in such a way that each cards stands on its shorter edge. The top-down view of that desk with cards upon it can be represented with the set of line segments with coordinates (x_i, y_i) to (v_i, w_i). The segments do not intersect.

The first card falls flat on its side, causing any card it touches to fall down also. The angle between vector (x_1, y_1)–(v_1, w_1) and the falling direction of the first card is equal to 90 degrees (measured counter-clockwise). If card Atouches card B, the direction of B’s fall is chosen so that the continuation of the direction vector does not cross the line containing segment A. Input data are guaranteed to never contain:

  1. a card falling exactly perpendicular to the other and

  2. a falling card that touches more than one of still standing cards.

Your program must determine which cards will fall, and which shall remain standing.

Input data

The first line of input file contains a numbers NH (1N100, H > 0) — the number of cards and the floating point height of a card. Each of the following N lines contains four floating-point numbers x_i y_i v_i w_i — coordinates of cards separated by spaces.

Output data

The output file must contain the list of fallen cards’ numbers, sorted in increasing order and separated by spaces.

Examples

Input example #1
3 100
10 10 50 40
10 0 50 30
20 90 20 20
Output example #1
1 3
 
Source ACM ICPC 2002/2003 Quarterfinal (Far-Eastern Subregion) Vladivostok, November 2, 2002.