#P1978C. Manhattan Permutations
Manhattan Permutations
Description
Let's call the Manhattan value of a permutation the value of the expression .
For example, for the permutation , the Manhattan value is , and for the permutation , the Manhattan value is .
You are given integers and . Find a permutation of length such that its Manhattan value is equal to , or determine that no such permutation exists.
A permutation of length is an array consisting of distinct integers from to in arbitrary order. For example, is a permutation, but is not a permutation ( appears twice in the array), and is also not a permutation ( but there is in the array).
Each test consists of multiple test cases. The first line contains a single integer () — the number of test cases. The description of the test cases follows.
The only line of each test case contains two integers and () — the length of the permutation and the required Manhattan value.
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, if there is no suitable permutation, output "No". Otherwise, in the first line, output "Yes", and in the second line, output distinct integers () — a suitable permutation.
If there are multiple solutions, output any of them.
You can output the answer in any case (for example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as a positive answer).
Input
Each test consists of multiple test cases. The first line contains a single integer () — the number of test cases. The description of the test cases follows.
The only line of each test case contains two integers and () — the length of the permutation and the required Manhattan value.
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case, if there is no suitable permutation, output "No". Otherwise, in the first line, output "Yes", and in the second line, output distinct integers () — a suitable permutation.
If there are multiple solutions, output any of them.
You can output the answer in any case (for example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as a positive answer).
Note
In the first test case, the permutation is suitable, its Manhattan value is .
In the second test case, it can be proven that there is no permutation of length with a Manhattan value of .
In the third test case, the permutation is suitable, its Manhattan value is .