#P1927E. Klever Permutation
Klever Permutation
No submission language available for this problem.
Description
You are given two integers and (), where is even.
A permutation of length is an array consisting of distinct integers from to in any order. For example, is a permutation, but is not a permutation (as appears twice in the array) and is also not a permutation (as , but is not present in the array).
Your task is to construct a -level permutation of length .
A permutation is called -level if, among all the sums of continuous segments of length (of which there are exactly ), any two sums differ by no more than .
More formally, to determine if the permutation is -level, first construct an array of length , where , i.e., the -th element is equal to the sum of .
A permutation is called -level if .
Find any -level permutation of length .
The first line of the input contains a single integer () — the number of test cases. This is followed by the description of the test cases.
The first and only line of each test case contains two integers and (, is even), where is the length of the desired permutation.
It is guaranteed that the sum of for all test cases does not exceed .
For each test case, output any -level permutation of length .
It is guaranteed that such a permutation always exists given the constraints.
Input
The first line of the input contains a single integer () — the number of test cases. This is followed by the description of the test cases.
The first and only line of each test case contains two integers and (, is even), where is the length of the desired permutation.
It is guaranteed that the sum of for all test cases does not exceed .
Output
For each test case, output any -level permutation of length .
It is guaranteed that such a permutation always exists given the constraints.
Note
In the second test case of the example:
- ;
- .