영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)
시간 제한 1초 · 메모리 제한 512 MB
Problem
Your task is to create a permutation of numbers 1,2,…,n whose longest monotone subsequence has exactly k elements.
A monotone subsequence is either increasing or decreasing. For example, some monotone subsequences in [2,1,4,5,3] are [2,4,5] and [4,3].
Input
The first input line has an integer t: the number of tests.
After this, there are t lines. Each line has two integers n and k.
Output
For each test, print a line that contains the permutation. You can print any valid solution. If there are no solutions, print IMPOSSIBLE.
Constraints
- 1 ≤ t ≤ 1000
- 1 ≤ k ≤ n ≤ 100
예제
예제 1
3 5 3 5 2 7 7
2 1 4 5 3 IMPOSSIBLE 1 2 3 4 5 6 7