This page is still under construction.

Parts of this page are still being built. What you see may change.

Build a City

Time limit3sMemory limit1024 MB

Summary
Given settlements and a per-move wall budget m, decide whether some order of acquiring them keeps each move's new wall length within m.
Level

Hard8 of 10

Topics
Geometry, Greedy, Sorting
Solved
No attempts yet

Problem

Recently, you have become addicted to a game called "Build a City".

The game is played on a two-dimensional map. The map has n+1n+1 human settlements labelled from 00 to nn, where settlement ii is at (xi,yi)(x_i, y_i) for i=0,1,…,ni=0, 1, \ldots, n. Settlement 00 is at the origin, so x0=y0=0x_0=y_0=0.

Your city is a rectangle made of walls, with sides parallel to the coordinate axes. A city contains a settlement when the settlement is inside or on the border of the rectangle.

At first, your city contains settlement 00 and is a degenerate rectangle at the origin. In one move, you acquire an unoccupied settlement and build walls to enclose it. The new city is the smallest axis-parallel rectangle that contains everything the old city contained plus the new settlement. Your goal is to enclose all settlements in your city.

In one move, the infrastructure department can build walls of total length up to mm. Existing walls can be reused, but they cannot be placed elsewhere. So the length of walls built in a move is the perimeter of the new rectangle minus the length of the common part of the old and new rectangles. If the new settlement is already inside the city, the length is zero.

You now want to know if there is an order in which to acquire the settlements so that the total length of walls built in each move does not exceed mm.

Input

The first line of input contains one integer TT, the number of test cases (1≤T≤5⋅1051 \leq T \leq 5 \cdot 10^5). For each test case:

The first line contains two integers nn and mm, the number of unoccupied settlements and the maximum total length of walls that can be built in one move (1≤n≤5⋅1051 \leq n \leq 5 \cdot 10^5, 1≤m≤4⋅1091 \leq m \leq 4 \cdot 10^9).

The ii-th of the following nn lines contains two integers xix_i and yiy_i, the coordinates of settlement ii (1≤xi,yi≤1091 \leq x_i, y_i \leq 10^9).

The sum of nn over all test cases does not exceed 5⋅1055 \cdot 10^5.

Output

For each test case, output a line containing the word Yes if such an order exists, or the word No otherwise.

Examples1

  1. Example 1

    Input
    3
    3 6
    1 1
    4 1
    2 2
    4 9
    1 4
    2 3
    3 2
    4 1
    10 14
    10 8
    1 6
    2 5
    4 2
    5 5
    8 9
    2 7
    6 8
    6 5
    7 4
    
    Expected output
    Yes
    No
    Yes