#P7841. Increasing and Decreasing
Increasing and Decreasing
Increasing and Decreasing
Problem Description
Notice:Don't output extra spaces at the end of one line. Given , please construct a permutation of length , satisfying that:
- The length of LIS(Longest Increasing Subsequence) is equal to .
- The length of LDS(Longest Decreasing Subsequence) is equal to . If there are multiple possible permutations satisfying all the conditions, print the lexicographically minimum one.
Input
The first line contains an integer , indicating the number of test cases. Each test case contains one line, which contains three integers .
Output
For each test case, the first line contains YES'' or
NO'', indicating if the answer exists. If the answer exists, output another line which contains integers, indicating the permutation.
Sample Input
4
10 1 10
10 10 1
10 5 5
10 8 8
Sample Output
YES
10 9 8 7 6 5 4 3 2 1
YES
1 2 3 4 5 6 7 8 9 10
YES
1 2 3 5 4 10 9 8 7 6
NO
Source
2020 Multi-University Training Contest 7