407698: GYM102875 L Leave from CPC
Description
Little Rabbit and Little Horse have been fighting for collegiate programming contest for almost four years. They plan to retire this year and so is it for many other members of the animal training team. Retirement means parting, and parting is inevitably full of sadness. If the retirement of one member will make the animal training team sad, then the retirement of multiple members will make everyone cry and fail to complete the final contest. Little Rabbit doesn't want this to happen, and he tells Little Horse to manage the number of retirements in each contest.
They get the list of the training teams and screened out the list of members who are expected to retire this year. Members in the list either participate in one contest or two contests — that's the rule of collegiate programming contest. Then each of the members who would like to retire will choose one contest he participates in to retire at that time. A contest can be described as a tuple $$$\langle x, y\rangle$$$, where $$$x$$$ represents the time, and $$$y$$$ represents the location. To simplify the problem, $$$x$$$ and $$$y$$$ are both positive integers and two contests $$$A$$$ and $$$B$$$ are defined to be close if $$$|A.x - B.x| \le d_x$$$ or $$$|A.y - B.y| \le d_y$$$. If any two members choose to retire in the same contest or two close contests, then everyone will be very sad and cry.
Little Rabbit and Little Horse want to know whether they can arrange everyone's retirement contests so that everyone will not cry and make it better to complete their final contests.
InputThe input contains several test cases.
The first line contains a single integer $$$T\ (1\le T\le 10^5)$$$, indicating the number of test cases.
For each test case: the first line contains three integers $$$n\ (1 \le n \le 2 \cdot 10^4)$$$ indicating the number of members who will retire this year, $$$d_x$$$ and $$$d_y\ (1 \le d_x, d_y \le 10^9)$$$ described above. Following $$$n$$$ lines, the $$$i$$$-th line starts with one integer $$$k\ (1 \le k \le 2)$$$ indicating the $$$i$$$-th member will take $$$k$$$ contest(s). Then $$$k$$$ tuple(s) $$$\langle x, y\rangle\ (1 \le x, y \le 10^9)$$$ follow, each describing the information of a contest.
It is guaranteed that the sum of $$$n$$$ will not exceed $$$10^5$$$.
OutputFor each test case, output the following text in a line: Yes if there is some arrangement so that everyone will not cry, or No if there does not exist such arrangement.
ExampleInput3 2 5 5 1 10 10 1 20 20 2 1 1 2 1 1 2 2 2 1 1 2 2 2 1 1 2 1 1 3 3 2 2 2 4 4Output
Yes No Yes