题号:NC256821
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
输入描述:
Each test contains multiple test cases. The first line contains the number of test cases

. The description of the test cases follows.
The first line contains two integers

,

(

,

).
The second line contains

integers

(

).
It is guaranteed that the sum of

over all test cases does not exceed

.
输出描述:
For each test case, output your operations in the following format.
If the number of beautiful sequences is less than
, output one line containing an integer
.
Otherwise, output one line containing
integers
separated by spaces --- the
-th smallest lexicographically legal beautiful sequence.
示例1
输入
复制
3
3 3
1 2
5 1
1 2 1 2
2 1
0