CF1705A.Mark the Photographer

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Mark the Photographer

Mark is asked to take a group photo of 2n2n people. The ii-th person has height hih_i units.

To do so, he ordered these people into two rows, the front row and the back row, each consisting of nn people. However, to ensure that everyone is seen properly, the jj-th person of the back row must be at least xx units taller than the jj-th person of the front row for each jj between 11 and nn, inclusive.

Help Mark determine if this is possible.

Input

The first line contains one integer tt (1t1001\leq t\leq 100) — the number of test cases. Each test case consists of two lines.

The first line of each test case contains two positive integers nn and xx (1n1001\leq n\leq 100, 1x1031\leq x\leq 10^3) — the number of people in each row and the minimum difference Mark wants.

The second line of each test case contains 2n2n positive integers h1,h2,,h2nh_1,h_2,\ldots,h_{2n} (1hi1031\leq h_i\leq 10^3) — the height of each person in units.

Note that the sum of nn over all test cases is not bounded.

Output

For each test case, print a single line containing "YES" if Mark could arrange people satisfying his condition and "NO" otherwise.

You may print each letter in any case (for example, YES, Yes, yes, yEs will all be recognized as positive answers).

Note

In the first test case, one possible order is to have the third, fifth, and sixth person on the back row and the second, first, and fourth on the front row. The heights of the people will look like this.

Back 99 1212 1616
Front 33 11 1010

It works because

  • h3h2=936h_3-h_2 = 9-3 \geq 6,
  • h5h1=1216h_5-h_1 = 12-1\geq 6, and
  • h6h4=16106h_6-h_4 = 16-10\geq 6.

In the second test case, it can be shown there is no way to order people in a way that satisfies the condition.

In the third test case, the only way to arrange people to satisfy the condition is to have the first person on the back row and the second person on the front row.

Samples

3
3 6
1 3 9 10 12 16
3 1
2 5 2 2 2 5
1 2
8 6
YES
NO
YES

在线编程 IDE

建议全屏模式获得最佳体验