#P1978C. Manhattan Permutations

    ID: 10696 Type: RemoteJudge 2000ms 256MiB Tried: 0 Accepted: 0 Difficulty: 4 Uploaded By: Tags>constructive algorithmsdata structuresgreedyimplementationmath*1300

Manhattan Permutations

Description

Let's call the Manhattan value of a permutation^{\dagger} pp the value of the expression p11+p22++pnn|p_1 - 1| + |p_2 - 2| + \ldots + |p_n - n|.

For example, for the permutation [1,2,3][1, 2, 3], the Manhattan value is 11+22+33=0|1 - 1| + |2 - 2| + |3 - 3| = 0, and for the permutation [3,1,2][3, 1, 2], the Manhattan value is 31+12+23=2+1+1=4|3 - 1| + |1 - 2| + |2 - 3| = 2 + 1 + 1 = 4.

You are given integers nn and kk. Find a permutation pp of length nn such that its Manhattan value is equal to kk, or determine that no such permutation exists.

^{\dagger}A permutation of length nn is an array consisting of nn distinct integers from 11 to nn in arbitrary order. For example, [2,3,1,5,4][2,3,1,5,4] is a permutation, but [1,2,2][1,2,2] is not a permutation (22 appears twice in the array), and [1,3,4][1,3,4] is also not a permutation (n=3n=3 but there is 44 in the array).

Each test consists of multiple test cases. The first line contains a single integer tt (1t1041 \leq t \leq 10^{4}) — the number of test cases. The description of the test cases follows.

The only line of each test case contains two integers nn and kk (1n2105,0k10121 \le n \le 2 \cdot 10^{5}, 0 \le k \le 10^{12}) — the length of the permutation and the required Manhattan value.

It is guaranteed that the sum of nn over all test cases does not exceed 21052 \cdot 10^{5}.

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 nn distinct integers p1,p2,,pnp_1, p_2, \ldots, p_n (1pin1 \le p_i \le n) — 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 tt (1t1041 \leq t \leq 10^{4}) — the number of test cases. The description of the test cases follows.

The only line of each test case contains two integers nn and kk (1n2105,0k10121 \le n \le 2 \cdot 10^{5}, 0 \le k \le 10^{12}) — the length of the permutation and the required Manhattan value.

It is guaranteed that the sum of nn over all test cases does not exceed 21052 \cdot 10^{5}.

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 nn distinct integers p1,p2,,pnp_1, p_2, \ldots, p_n (1pin1 \le p_i \le n) — 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).

Sample Input 1

8
3 4
4 5
7 0
1 1000000000000
8 14
112 777
5 12
5 2

Sample Output 1

Yes
3 1 2
No
Yes
1 2 3 4 5 6 7
No
Yes
8 2 3 4 5 6 1 7
No
Yes
5 4 3 1 2
Yes
2 1 3 4 5

Note

In the first test case, the permutation [3,1,2][3, 1, 2] is suitable, its Manhattan value is 31+12+23=2+1+1=4|3 - 1| + |1 - 2| + |2 - 3| = 2 + 1 + 1 = 4.

In the second test case, it can be proven that there is no permutation of length 44 with a Manhattan value of 55.

In the third test case, the permutation [1,2,3,4,5,6,7][1,2,3,4,5,6,7] is suitable, its Manhattan value is 11+22+33+44+55+66+77=0|1-1|+|2-2|+|3-3|+|4-4|+|5-5|+|6-6|+|7-7|=0.