CF1992C.Gorilla and Permutation

传统题 时间 2000 ms 内存 256 MiB 4 尝试 1 已通过 1 标签

Gorilla and Permutation

Gorilla and Noobish_Monk found three numbers nn, mm, and kk (m<km \lt k). They decided to construct a permutation^{\dagger} of length nn.

For the permutation, Noobish_Monk came up with the following function: g(i)g(i) is the sum of all the numbers in the permutation on a prefix of length ii that are not greater than mm. Similarly, Gorilla came up with the function ff, where f(i)f(i) is the sum of all the numbers in the permutation on a prefix of length ii that are not less than kk. A prefix of length ii is a subarray consisting of the first ii elements of the original array.

For example, if n=5n = 5, m=2m = 2, k=5k = 5, and the permutation is [5,3,4,1,2][5, 3, 4, 1, 2], then:

  • f(1)=5f(1) = 5, because 555 \ge 5; g(1)=0g(1) = 0, because 5>25 \gt 2;
  • f(2)=5f(2) = 5, because 3<53 \lt 5; g(2)=0g(2) = 0, because 3>23 \gt 2;
  • f(3)=5f(3) = 5, because 4<54 \lt 5; g(3)=0g(3) = 0, because 4>24 \gt 2;
  • f(4)=5f(4) = 5, because 1<51 \lt 5; g(4)=1g(4) = 1, because 121 \le 2;
  • f(5)=5f(5) = 5, because 2<52 \lt 5; g(5)=1+2=3g(5) = 1 + 2 = 3, because 222 \le 2.

Help them find a permutation for which the value of (umi=1nf(i)umi=1ng(i))\left( um_{i=1}^n f(i) - um_{i=1}^n g(i)\right) is maximized.

^{\dagger}A permutation of length nn is an array consisting of nn distinct integers from 11 to nn in any order. For example, [2,3,1,5,4][2,3,1,5,4] is a permutation, but [1,2,2][1,2,2] is not a permutation (as 22 appears twice in the array) and [1,3,4][1,3,4] is also not a permutation (as n=3n=3, but 44 appears in the array).

Input

The first line contains a single integer tt (1t1041 \le t \le 10^4)  — the number of test cases.

The only line of each case contains three integers nn, mm, kk (2n1052\le n \le 10^5; 1m<kn1 \le m \lt k \le n) — the size of the permutation to be constructed and two integers.

It is guaranteed that the sum of nn over all test cases does not exceed 21052 \cdot 10^5.

Output

For each test case, output the permutation  — a set of numbers that satisfies the conditions of the problem. If there are multiple solutions, output any of them.

Note

In the first example, $\left( um_{i=1}^n f(i) - um_{i=1}^n g(i)\right) = 5 \cdot 5 - (0 \cdot 3 + 1 + 3) = 25 - 4 = 21$

Samples

3
5 2 5
3 1 3
10 3 8
5 3 4 1 2
3 2 1
10 9 8 4 7 5 6 1 2 3

在线编程 IDE

建议全屏模式获得最佳体验