Chef Ada is the FootBall coach of the Dinosaurs Institute of Technology.
There are $N$ dinosaurs (enumerated $1$ through $N$) placed in a line. The i-th dinosaur has a height of $i$ meters.
Ada is training The dinosaurs in the following tactic:
- Initially the leftmost dinosaur has the ball.
- The dinosaur that has the ball passes the ball to the nearest dinosaur to the right that is tallest than him.
- The previous step continues until the ball reaches the tallest dinosaur, then he throws the ball and scores a goal!
Help Ada reordering the dinosaurs in such a way that the ball is passed from dinosaur to dinosaur exactly $K$ times.
For example, if there are $5$ dinosaurs ordered as $[2,3,1,5,4]$, then the ball goes $2 \rightarrow 3\rightarrow5 \rightarrow goal$, and the ball was passed two times.

-----Input:-----
- First line will contain $T$, number of testcases.
- Each test case consist of a line with two space separated integers $N,K$.

-----Output:-----
For each testcase, output in a single line conaining $N$ integers representing one possible ordering in which the dinosaurs can be placed.

-----Constraints-----
- $1 \leq T \leq 2^8$
- $2 \leq N \leq 20$
- $0 \leq K \leq N-1$

-----Sample Input:-----
1
5 2

-----Sample Output:-----
2 3 1 5 4

Difficulty: interview

Starter code:

Solutions:
# cook your dish here
t=int(input())
while t!=0:
 n,k=map(int,input().split())
 lst=[]
 for i in range(1,n+1):
  lst.append(i)
 lst[k],lst[n-1]=lst[n-1],lst[k]
 for item in lst:
  print(item,end=' ')
 t-=1

# cook your dish here
t=int(input())
inputs=[]
for i in range(0,t):
 n,k=map(int,input().split())
 a=[]
 for i in range(n,0,-1):
  a.append(i)
 a[0:k+1]=reversed(a[0:k+1])
 print(*a)

# cook your dish here
t=int(input())
for _ in range(t):
 n,k=map(int,input().split())
 a=[]
 c=n
 for i in range(n):
  a.append(c)
  c=c-1
 a[0:k+1]=reversed(a[0:k+1])
 print(*a)

# cook your dish here
t=int(input())
for _ in range(t):
 n,k=map(int,input().split())
 a=[]
 c=n
 for i in range(n):
  a.append(c)
  c=c-1
 a[0:k+1]=reversed(a[0:k+1])
 print(*a)

for _ in range(int(input())):
 a = input().split()
 n = int(a[0])
 k = int(a[1])
 print(n-k, end=" ")
 for i in range(1,n-k):
  print(i, end=" ")
 for i in range(n-k+1,n+1):
  print(i, end=" ")




for i in range(int(input())):
 n,k = list(map(int,input().split()))

 t=[]


 for j in range(n,n-k-1,-1):
  t.append(j)
 t=t[::-1]

 p=[]
 for i in range(1,n-k):
  p.append(i)

 print(*(t[:2]+p+t[2:]))
  


# cook your dish here
t = int(input())
for _ in range(t):
 n,k = list(map(int,input().strip().split()))
 a=n-k
 for i in range(a,n+1):
  print(i,end=" ")
 for i in range(1,a):
  print(i,end=" ")
 print("")

for _ in range(int(input())):
 n,k= list(map(int, input().strip().split()))
 a=n-k
 for i in range(a,n+1):
  print(i,end=" ")
 for i in range(1,a):
  print(i,end=" ")
 print("")

# cook your dish here
test = int(input())
for t in range(test):
 n,k = list(map(int,input().strip().split()))
 numbers = []
 for i in range(n):
  numbers.append(i+1)
 temp = numbers[k]
 numbers[k] = numbers[n-1]
 numbers[n-1] = temp
 answer = ' '
 for num in numbers:
  answer = answer + str(num) + ' '
 print(answer.strip())


# cook your dish here
t = int(input())

for _ in range(t):
 n,k = map(int , input().split(" "))
 
 l=[]
 for i in range(1,n+1):
  l.append(i)
 
 l[-1] , l[k] = l[k] , l[-1]
 for i in l:
  print(i , end=" ")

for _ in range(int(input())):
 n,k= list(map(int, input().strip().split()))
 a=n-k
 for i in range(a,n+1):
  print(i,end=" ")
 for i in range(1,a):
  print(i,end=" ")
 print("")

for _ in range(int(input())):
 a, b = map(int,input().split())
 team = list(list(range(1, b+1)) + [a] + list(range(b+1,a)))
 print(' '.join(map(str, team)))

# MOD = 1000000007
for _ in range(int(input())):
 n,k = list(map(int,input().split()))
 # n = int(input())
 # ings = list(map(int,input().split()))
 dinos = list(range(1,k+1)) + [n] + list(range(k+1,n))
 print(' '.join(map(str,dinos)))


for _ in range(int(input())):
 n,k= list(map(int, input().strip().split()))
 a=n-k
 for i in range(a,n+1):
  print(i,end=" ")
 for i in range(1,a):
  print(i,end=" ")
 print("")

# cook your dish here
for _ in range(int(input())):
 n,k= list(map(int, input().strip().split()))
 a=n-k
 for i in range(a,n+1):
  print(i,end=" ")
 for i in range(1,a):
  print(i,end=" ")
 print("")

t = int(input())

for _ in range(t):
 n, k = [int(x) for x in input().split()]
 
 a = []
 for i in range(1, n+1):
  a.append(str(i))
 
 ans = a[n-k-1:] + a[:n-k-1]
 
 print(" ".join(ans))

''' author: Priyank Koul, PES University, Bengaluru'''
for _ in range(int(input())):
 n,k= list(map(int, input().strip().split()))
 a=n-k
 for i in range(a,n+1):
  print(i,end=" ")
 for i in range(1,a):
  print(i,end=" ")
 print("")

# cook your dish here
t = int(input())
for i in range(t):
  n, k = map(int,input().split())
  din=list(range(1,n+1))
  form=din[-(k+1):]
  form+=(din[0:-(k+1)])
  print(*form)

# cook your dish here
a = int(input())
for i in range(a):
 b = str(input()).split(' ')
 li = [0]*int(b[0])
 for j in range(int(b[0])):
  li[j]+=(j+1)
 if int(b[0])==int(b[1])+1:
  print(*li)
 else:
  li.sort()
  li.remove(int(b[0]))
  li.remove(int(b[1])+1)
  li.insert(int(b[1]),int(b[0]))
  li.insert(int(b[0])-1,int(b[1])+1)
  print(*li)

t=int(input())
for i in range(t):
 n,k=list(map(int,input().split()))
 list1=[i for i in range(1,n)]
 list2=[]
 for i in range(1,k+1):
  list2.append(i)
  list1.remove(i)
 list2.append(n)
 for i in list1:
  list2.append(i)
 print(*list2)
 


# cook your dish here
try:
 for _ in range(int(input())):
  n,k = map(int,input().split())
  ans = [0]*n
  for i in range(k):
   ans[i] = i+1
  ans[k] = n
  ans[n-1] = k+1
  for j in range(k+1,n-1):
   ans[j] = j + 1
  print(*ans)
   
except:
 pass

for _ in range(int(input())):
 N, K = map(int, input().rstrip().split())
 L1 = [i for i in range(N-K, N+1)]
 L2 = [i for i in range(1, N-K)]
 print(*L1, *L2)
 

'''
N=5, K=2 => N-K+1 = 4    (1,2,3)
      3 -> 4 -> /5/ -> 1 -> 2
'''

T = int(input())
while T > 0:
 N, K = map(int, input().split())
 T = T - 1
 r1 = 1
 r2 = K
 def createList(r1, r2):
  return list(range(r1, r2 + 1))
 L = createList(1, K)
 L.append(N)
 k = K + 1
 while k < N:
  L.append(k)
  k = k + 1
 print(*L)

t=int(input())
for i in range(t):
 n,k=list(map(int,input().split()))
 l=[]
 for i in range(1,n+1):
  l.append(i)
 l.sort()
 l[k],l[-1]=l[-1],l[k]
 print(*l) 


try:
 test = int(input())
 while test > 0:
  n , k = map(int, input().split())
  a = []
  temp = k + 1
  if k == 0:
   a.append(n)
   for i in range(n - 1):
    a.append(i + 1)
  else:
   a.append(n - k) #the k + 1th greatest element
   num = n - k + 1 #the next greatest element.
   for _ in range(k):
    a.append(num)
    num += 1
   temp = n - k - 1
   for i in range(temp):
    a.append(i + 1)
  for num in a:
   print(num, end=' ')
  test -= 1
except:
 pass