Lucky Light

No attempts yetTime limit1sMemory limit128 MB

Problem

A point light source sits at (xL,yL)(x_L, y_L) with yL>0y_L > 0, and there are finitely many line segments of non-zero length, each given by the coordinates of its two endpoints. All endpoints are distinct. Every segment lies above the xx-axis, in the region y>0y > 0.

The segments cast shadows onto the xx-axis. The shadows of two segments either do not overlap at all, or overlap in an interval of non-zero width. They never touch at a single point. No segment has a shadow that shrinks to a point either, so no segment is aimed straight at the light source. The height yLy_L is at least 1 larger than the yy-coordinate of every endpoint, so every segment leaves a bounded shadow on the xx-axis.

The shadows split the xx-axis into dark and lighted areas. Determine how many lighted areas there are. With at least one segment the count is 2 or more, and with no segments it is 1.

In the picture below the three segments A, B and C create three lighted areas.

The shadows of segments A, B and C and the lighted areas between them

Input

The first line contains the number of test cases. Each test case has the following format.

  • One line with the number of segments nn. (0n1000 \le n \le 100)
  • One line with the coordinates xLx_L and yLy_L of the light source, separated by a single space. (100xL100-100 \le x_L \le 100, 1yL10001 \le y_L \le 1000)
  • nn lines, each with four integers xix_i, yiy_i, uiu_i and viv_i separated by single spaces, giving the two endpoints (xi,yi)(x_i, y_i) and (ui,vi)(u_i, v_i) of the iith segment. (100xi,ui100-100 \le x_i, u_i \le 100, 0<yi,vi<yL0 < y_i, v_i < y_L)

Output

For every test case, print the number of lighted areas on its own line.

Hint

The first test case of sample input 1 corresponds to the picture in the statement. The second test case has two crossing segments.