405468: GYM101968 D Two Sequences
Description
You are given two sequences of integers $$$A$$$ and $$$B$$$, and an integer $$$k$$$.
Two sequences are equal if it is possible to rearrange one of the sequences such that each element in the sequence is equal to the corresponding element from the other sequence.
You can select one of the elements in sequence $$$A$$$, and add to it any integer from the range $$$[-k,k]$$$. Is it possible to make the two sequences equal by doing the specified operation exactly once?
InputThe first line of input contains a single integer $$$T$$$, the number of test cases.
The first line of each case contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 10^{5}$$$)($$$1 \le k \le 10^{9}$$$), the length of each sequence and the number $$$k$$$ specified in the problem statement.
The next line contains $$$n$$$ space-separated integers ($$$1 \le A_{i} \le 10^{9}$$$), the elements in sequence $$$A$$$.
The next line contains $$$n$$$ space-separated integers ($$$1 \le B_{i} \le 10^{9}$$$), the elements in sequence $$$B$$$.
OutputFor each test case, output a single line with YES if it is possible to make the two sequences equal in a single operation. Otherwise output NO.
ExampleInput3Output
3 2
1 2 3
3 2 1
4 2
1 9 1 1
6 1 1 1
2 4
1 5
1 1
YES
NO
YES