You are walking on a road that is stretched to the infinite distance in both directions. The road can be imagined as a rectangle whose bottom left corner is at \((0,0)\) and the top right corner is at \((W,L)\) on the plane. There are \(n\)holes in the plane. Each hole is a rectangle whose upper-left vertex coordinate is \((x_1,y_1)\) and right-bottom vertex coordinate is \((x_2,y_2)\). Now, the inner area of every hole is filled with water. You are required to jump through them but only if it is necessary. Therefore, you must always try to avoid the holes in your path. You can only jump above these holes and you will land back to the ground once you cross a hole. The holes can intersect to form larger holes.
You start walking at any point on the bottom side (start line) of the road that is situated at any point in \((0...W,0)\)) and have to reach any point on the top side (finish line) of the road that is situated at any point in \((0...W,L)\). None of the holes intersects with the start or the finish line.
You can jump through one or more intersecting holes but it takes a large amount of time, therefore, you jump through them only if necessary. You must stay inside the road at all times.
Note: If two holes are colliding with each other by the border, then they are considered to be intersecting and you cannot pass these holes without jumping through them.
What is the minimum number of times you must jump in order to reach the endpoint?
Input format
- First line: A single integer \(T\) denoting the number of test cases
- For each test case:
- First line: Three integers \(n,W,L\) denoting the number of holes, the width, the length of the road
- Each of the following \(n\) lines: Four integers \((x_1,y_1),(x_2,y_2)\) denoting the coordinates of the two vertices of the \(i_{th}\) hole
Output Format
For each test case, print a single line containing a single integer denoting the minimum number of times you must jump.
Constraints
\(1 \le n \le 1000\)
\(1\le W, L \le 10^9\)
\(0\le x_1,x_2 \le 10^9\)
\(0 < y_1,y_2 < 10^9\)
\(x_1 < x_2\)
\(y_2 < y_1\)
\(1 \le T \le 10\)