#P1726B. Mainak and Interesting Sequence

    ID: 7915 Type: RemoteJudge 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>bitmasksconstructive algorithmsmath

Mainak and Interesting Sequence

No submission language available for this problem.

Description

Mainak has two positive integers nn and mm.

Mainak finds a sequence a1,a2,,ana_1, a_2, \ldots, a_n of nn positive integers interesting, if for all integers ii (1in1 \le i \le n), the bitwise XOR of all elements in aa which are strictly less than aia_i is 00. Formally if pip_i is the bitwise XOR of all elements in aa which are strictly less than aia_i, then aa is an interesting sequence if p1=p2==pn=0p_1 = p_2 = \ldots = p_n = 0.

For example, sequences [1,3,2,3,1,2,3][1,3,2,3,1,2,3], [4,4,4,4][4,4,4,4], [25][25] are interesting, whereas [1,2,3,4][1,2,3,4] (p2=10p_2 = 1 \ne 0), [4,1,1,2,4][4,1,1,2,4] (p1=112=20p_1 = 1 \oplus 1 \oplus 2 = 2 \ne 0), [29,30,30][29,30,30] (p2=290p_2 = 29 \ne 0) aren't interesting.

Here aba \oplus b denotes bitwise XOR of integers aa and bb.

Find any interesting sequence a1,a2,,ana_1, a_2, \ldots, a_n (or report that there exists no such sequence) such that the sum of the elements in the sequence aa is equal to mm, i.e. a1+a2+an=ma_1 + a_2 \ldots + a_n = m.

As a reminder, the bitwise XOR of an empty sequence is considered to be 00.

Each test contains multiple test cases. The first line contains a single integer tt (1t1051 \le t \le 10^5) — the number of test cases. Description of the test cases follows.

The first line and the only line of each test case contains two integers nn and mm (1n1051 \le n \le 10^5, 1m1091 \le m \le 10^9) — the length of the sequence and the sum of the elements.

It is guaranteed that the sum of nn over all test cases does not exceed 10510^5.

For each test case, if there exists some interesting sequence, output "Yes" on the first line, otherwise output "No". You may print each letter in any case (for example, "YES", "Yes", "yes", "yEs" will all be recognized as positive answer).

If the answer is "Yes", output nn positive integers a1,a2,,ana_1, a_2, \ldots, a_n (ai1a_i \ge 1), forming an interesting sequence such that a1+a2+an=ma_1 + a_2 \ldots + a_n = m. If there are multiple solutions, output any.

Input

Each test contains multiple test cases. The first line contains a single integer tt (1t1051 \le t \le 10^5) — the number of test cases. Description of the test cases follows.

The first line and the only line of each test case contains two integers nn and mm (1n1051 \le n \le 10^5, 1m1091 \le m \le 10^9) — the length of the sequence and the sum of the elements.

It is guaranteed that the sum of nn over all test cases does not exceed 10510^5.

Output

For each test case, if there exists some interesting sequence, output "Yes" on the first line, otherwise output "No". You may print each letter in any case (for example, "YES", "Yes", "yes", "yEs" will all be recognized as positive answer).

If the answer is "Yes", output nn positive integers a1,a2,,ana_1, a_2, \ldots, a_n (ai1a_i \ge 1), forming an interesting sequence such that a1+a2+an=ma_1 + a_2 \ldots + a_n = m. If there are multiple solutions, output any.

Sample Input 1

4
1 3
6 12
2 1
3 6

Sample Output 1

Yes
3
Yes
1 3 2 2 3 1
No
Yes
2 2 2

Note

  • In the first test case, [3][3] is the only interesting sequence of length 11 having sum 33.
  • In the third test case, there is no sequence of length 22 having sum of elements equal to 11, so there is no such interesting sequence.
  • In the fourth test case, p1=p2=p3=0p_1 = p_2 = p_3 = 0, because bitwise XOR of an empty sequence is 00.