SP407 RNUMBER - Random Number

Description

A Black Box algorithm supposes that natural number sequence ![$u(1), u(2), dots, u(N)$](https://cdn.luogu.com.cn/upload/vjudge_pic/SP407/007d5bad8aa9896127a4c95039a901178b2dfddc.png) is sorted in non-descending order, ![$N le M$](https://cdn.luogu.com.cn/upload/vjudge_pic/SP407/3c3496270b38cc16c79fcc1526ea5cb55b151ea8.png) and for each _p_ ( ![$1 le p le N$](https://cdn.luogu.com.cn/upload/vjudge_pic/SP407/6926209ba2ce331e001bb9fbe66017c1ee203c3b.png)) an inequality ![$p le u(p) le M$](https://cdn.luogu.com.cn/upload/vjudge_pic/SP407/a3dd1666fa708c004c29322a0ddb257036350f9b.png) is valid. Making tests for this algorithm we have met with the following problem. For setting a random sequence ![${u(i)}$](https://cdn.luogu.com.cn/upload/vjudge_pic/SP407/9f7a9e6d27c1006e9bd3d23173bbffa4cbd8becd.png) a usual random data generator did not fit. As the sequence itself had been imposed certain restrictions, the method of choosing the next random element (in the interval defined by restrictions) did not give the random sequence as a whole. We have come to a conclusion that the problem can be solved in the following way. If we arrange all possible sequences in certain order (for example, in lexicographical order) and assign each sequence its number, after choice of the random number it is possible to take the correspondent sequence for the random one. At the first glance it seems enough to make up a program generating all these sequences in such order. Alas! Even having not great values of _M_ and _N_ it would have taken any powerful modern computer centuries to enumerate all such sequences. It turned out it was possible to avoid generating all sequences if we managed to create required sequence according to its number immediately. But even this statement does not cover all. As the amount of sequences is quite large, the number can be a long one, composed of hundreds decimal digits, though our random data generator could give only normal numbers. We decided to produce a long random number from a real random number distributed in \[0,1\]. Namely, present the number in binary notation: ![$0.b(1)b(2)dots$](https://cdn.luogu.com.cn/upload/vjudge_pic/SP407/fbe6882689874df4f67012a69a256855f9b29482.png), where all _b_(_i_) = 0 or 1. Let us set a regulation to associate such real number to an integer from \[_A_,_B_\] segment:

Input Format

The first line of the input is an integer K ≤ 10, followed by K datasets. The first line of each dataset contains _M_ and _N_. The second line contains binary real number ![$0.b(1)b(2)dots b(p)$](https://cdn.luogu.com.cn/upload/vjudge_pic/SP407/e7f6ecaf55bd6f30f8424becc48060a18140532c.png) (without leading, trailing and other spaces).

Output Format

For each dataset, write into the output data file the corresponding sequence ![$u(1), u(2), dots, u(N)$](https://cdn.luogu.com.cn/upload/vjudge_pic/SP407/007d5bad8aa9896127a4c95039a901178b2dfddc.png). The sequence numbers should be separated with spaces and end-of-line characters. There should be up to 20 numbers in each line. If neccesary, the numbers will have leading blanks to occupy 3 characters.