March of the Penguins

Time limit5sMemory limit128 MB

Problem

Several penguins live on a glacier field in Antarctica. Each penguin stands on one of many ice floes drifting on the sea. A single floe may hold several penguins, and some floes may hold none at all.

Penguins are highly social, so they all want to gather on one floe. To do this they pick one floe as the destination and jump from floe to floe until every penguin has gathered there. Penguins cannot fly, however, so they cannot reach a floe that is too far away: a penguin may jump between two floes only if the Euclidean distance between them is at most $D$.

Because of global warming the floes are melting, and some crack and sink after being used too many times. The penguins are experts on ice and know exactly how many jumps each floe can bear. When a penguin jumps from one floe to another, the floe it leaves (was standing on) is damaged once, while the floe it lands on is not. In other words, at most $m_i$ jumps may depart from floe $i$.

Determine every floe on which all the penguins can gather.

Input

The first line contains the number of test cases $T$ ($T \le 100$).

Each test case is given as follows.

  • The first line contains the number of floes $N$ ($1 \le N \le 100$) and the maximum jump distance $D$ ($0 \le D \le 100000$). $D$ may be a real number.
  • Each of the next $N$ lines contains $x_i$, $y_i$, $n_i$, $m_i$.
    • $x_i$, $y_i$: the coordinates of the floe ($-10000 \le x_i, y_i \le 10000$)
    • $n_i$: the number of penguins standing on that floe ($0 \le n_i \le 10$)
    • $m_i$: the maximum number of jumps that may depart from that floe ($1 \le m_i \le 200$)

Floes are numbered from $0$ in the order they are given.

Output

For each test case, print on one line the numbers of all floes on which every penguin can gather, in ascending order and separated by spaces. If no floe allows all penguins to gather, print $-1$ on that line instead.