The Archivist's Inspection
The head archivist has a strict routine for checking a shelf of volumes numbered 1 to n. Every inspection she performs is applied to a contiguous stretch of the shelf, and it goes like this:
- She writes one tick in her logbook.
- If the volumes in the stretch already stand in increasing order of their numbers from left to right (a stretch of a single volume always does), she walks away.
- Otherwise she splits the stretch into a left part made of its first
⌈len/2⌉volumes and a right part made of the remaining⌊len/2⌋volumes, wherelenis the length of the stretch. She inspects the left part completely, then inspects the right part completely, and finally rearranges the whole stretch into increasing order.
Each morning she starts with one inspection of the entire shelf. Note that a part is checked for order at the moment its own inspection begins, so the right part is checked after the left part has already been inspected and rearranged.
Her apprentice Bob is setting the shelf up for tomorrow and wants her logbook to end up with exactly k ticks. Help Bob: find an arrangement of the volumes 1, 2, …, n on the shelf for which the morning inspection writes exactly k ticks, or report that no arrangement does.
Input
The first line contains t (1 ≤ t ≤ 10^4), the number of test cases. Each of the next t lines contains two integers n and k (1 ≤ n ≤ 2·10^5, 1 ≤ k ≤ 10^9). The sum of n over all test cases does not exceed 2·10^5.
Output
For each test case, print one line. If no arrangement gives exactly k ticks, print -1. Otherwise print n distinct integers from 1 to n: the volume numbers on the shelf from left to right.
If several arrangements work, print any of them.
Notes
In the first example, the shelf 1 3 2 is not in order (tick 1), so it is split into 1 3 and 2. Both parts are in order, giving ticks 2 and 3. For the shelf 3 1 4 2, the whole shelf gets a tick and is split into 3 1 and 4 2; each of those gets a tick, is out of order and splits into two single volumes, which get one tick each. That is 1 + 3 + 3 = 7 ticks. For n = 4, k = 4 no arrangement works.
In the second example, the last shelf is 4 1 2 3 6 5. The whole shelf (tick 1) splits into 4 1 2 and 3 6 5. The part 4 1 2 (tick 2) splits into 4 1 (tick 3, then two more ticks for 4 and 1) and 2 (tick 6). The part 3 6 5 (tick 7) splits into 3 6, which is in order (tick 8), and 5 (tick 9).