Constructive Fun#11839

Constructive Fun

1 second
256 megabytes
Hard

"Oh No No No"

—TheFatRat - No No No

You are given two integers and . Your task is to construct any array of integers a_1,a_2,...,a_n such that

\displaystyle \sum_{i=1}^n \sum_{j=i+1}^n |a_i-a_j|=k

Input

The first line contains a single integer (1 \le t \le 10^4) – the number of test cases.

The only line of each test case contains two integers , (1 \le n \le 10^6 ; 0 \le k \le 10^6) – the length of array and the required value.

Additional constraints :

  • It's guaranteed that the sum of doesn't exceed 10^6 across all test cases.

  • It's guaranteed that the sum of doesn't exceed 6 \cdot 10^6 across all test cases.

Output

For each test case, output any valid array (a_1,a_2,...,a_n) where (1 \le a_1,a_2,...,a_n \le 10^{9})

It's guaranteed that there exists at least one valid array across all tests.

Examples

Example 1

Loading
Loading

Note

In the first test case, a=[10,11,12] is valid because :

  • For the first index |11-10|+|12-10|=1+2=3.

  • For the second index |12-11|=1.

Total of .

For the second test case , a=[1,10,4,2] is valid because :

  • For the first index |10-1|+|4-1|+|2-1|=9+3+1=13.

  • For the second index |4-10|+|2-10|=6+8=14.

  • For the third and fourth indices |4-2|=2.

Total of .

For the third test case , a=[1 ,3 ,8 ,2 ,1 ,10, 11] is valid because :

  • For the first index |3-1|+|8-1|+|2-1|+|1-1|+|10-1|+|11-1|=29.

  • For the second index |8-3|+|2-3|+|1-3|+|10-3|+|11-3|=23.

  • For the third index |2-8|+|1-8|+|10-8|+|11-8|=18.

  • For the fourth index |1-2|+|10-2|+|11-2|=18.

  • For the fifth index |10-1|+|11-1|=19.

  • For the sixth index |11-10|=1.

Total of .

For the fourth test case , a=[2,4,8,7,1] is valid because :

  • For the first index |4-2|+|8-2|+|7-2|+|1-2|=14.

  • For the second index |8-4|+|8-7|+|8-1|=10.

  • For the third index |7-8|+|1-8|=8.

  • For the fourth index |1-7|=6.

Total of .

Scoring

  1. Subtask ( points) : (k=0).

  2. Subtask ( points) : It's guaranteed that there exists an array that satisfies the conditions with (a_i \in \{1,2\}) and (1 \le n \le 20).

  3. Subtask ( points) : (1 \le k \le 10).

  4. Subtask ( points) : (1 \le k \le 100).

  5. Subtask ( points) : (1 \le k \le 1000).

  6. Subtask ( points) : (1 \le k \le 10^4).

  7. Subtask ( points) : (1 \le \sum n\cdot k \le 10^6).

  8. Subtask ( points) : No additional Constraints.