405468: GYM101968 D Two Sequences

Memory Limit:256 MB Time Limit:6 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Two Sequencestime limit per test6 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

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?

Input

The 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$$$.

Output

For 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.

ExampleInput
3
3 2
1 2 3
3 2 1
4 2
1 9 1 1
6 1 1 1
2 4
1 5
1 1
Output
YES
NO
YES

加入题单

算法标签: