#P3043. Number game
Number game
Problem Description
One day, QQ is playing a number game. He first sorts the N numbers 1, 2, 3…n, but this is too easy. So long1 wants to challenge QQ’s skill, he let the number sequence becomes wavy. For example, a1<a2>a3<a4>a5… or a1>a2<a3>a4<a5….
Now long1 sorts these wavy sequences by lexicographic order, and he wants to know what the M-th sequence is when you have N numbers.
As an Acmer, long1 thinks you can solve it and gives him the answer.
Input
There are many test cases:
For every case:
First line is the number of case
The next case lines:
Every line contains two numbers N, and M.(1<=N<=20,M is not larger than the number of wavy sequences)
Output
For every case, output the sequence.
2
2 1
3 3
1 2
2 3 1
Hint
Hint: You can assume that the number of total wavy sequences will not beyond INT64.