You are given two positive integers $N$ and $K$, where $K \le N$. Find a sequence $A_1, A_2, \ldots, A_N$ such that:
- for each valid $i$, $A_i$ is either $i$ or $-i$
- there are exactly $K$ values of $i$ such that $1 \le i \le N$ and $A_1 + A_2 + \ldots + A_i > 0$
If there are multiple solutions, you may print any one of them. It can be proved that at least one solution always exists.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first and only line of each test case contains two space-separated integers $N$ and $K$.

-----Output-----
For each test case, print a single line containing $N$ space-separated integers $A_1, A_2, \ldots, A_N$.

-----Constraints-----
- $1 \le T \le 1,000$
- $1 \le K \le N \le 1,000$

-----Subtasks-----
Subtask #1 (10 points): $N \le 10$
Subtask #2 (90 points): original constraints

-----Example Input-----
1
3 3

-----Example Output-----
1 2 3

Starter code:

Solutions:
test=int(input())
for i in range(test):
 n,k=map(int,input().split())
 x=n-k
 for j in range(1,n+1):
  if(j%2==0 and x>0):
   print(-j,end=' ')
   x-=1
  elif(k<=0):
   print(-j,end=' ')
  else:
   print(j,end=' ')
   k-=1
 print()

# cook your dish here
import math

try:
 tc = int(input())
 for _ in range(tc):
  n, k = list(map(int, input().split()))
  ans = []
  need = 0
  for i in range(1, n+1):
   if i % 2 != 0:
    ans.append(i)
   else:
    ans.append(-i)
  p = math.ceil(n/2)

  need = p - k if p > k else k-p

  if k < p:
   i = n-1
   while need > 0:
    if ans[i] > 0:
     ans[i] *= -1
     need -= 1
    i -= 1

  if k > p:
   i = n-1
   while need > 0:
    if ans[i] < 0:
     ans[i] *= -1
     need -= 1
    i -= 1
  print(*ans)
except:
 pass


# cook your dish here
t=int(input())
import math
while t:
 t=t-1
 n,k=input().split()
 n=int(n)
 k=int(k)
 l=[-1*(i+1) for i in range(n)]
 for i in range(1,n,2):
  l[i]=l[i]*(-1)
 #print(l)
 if k-(math.floor(n/2))>0:
  s=k-(math.floor(n/2))
  i=n-1
  while s:
   # print(s,i,l,"**")
   if l[i]<0:
    # print(s,i,l,"*")
    l[i]=(-1)*l[i]
    s=s-1
   i=i-1
 if (math.floor(n/2))-k>0:
  s=(math.floor(n/2))-k
  i=n-1
  while s:
   if l[i]>0:
    l[i]=(-1)*l[i]
    s=s-1
   i=i-1
 for i in range(n):
  print(l[i],end=" ")

# cook your dish here
t=int(input())
import math
while t:
 t=t-1
 n,k=input().split()
 n=int(n)
 k=int(k)
 l=[-1*(i+1) for i in range(n)]
 for i in range(1,n,2):
  l[i]=l[i]*(-1)
 #print(l)
 if k-(math.floor(n/2))>0:
  s=k-(math.floor(n/2))
  while s:
   for i in range(n-1,-1,-1):
    # print(i,s,"*",l)
    if l[i]<0:
     l[i]=(-1)*l[i]
     s=s-1
     break
 if (math.floor(n/2))-k>0:
  s=(math.floor(n/2))-k
  while s:
   for i in range(n-1,-1,-1):
    if l[i]>0:
     l[i]=(-1)*l[i]
     s=s-1
     break
 for i in range(n):
  print(l[i],end=" ")

t = int(input())

while (t > 0):
 n, k = map(int, input().split())
 a = list()
 if 2*k <= n:
  for i in range(2*k):
   if i % 2 == 0:
    a.append(i+1)
   else:
    a.append(-i-1)
  for i in range(2*k, n, 1):
   a.append(-i-1)
 elif 2*k > n:
  for i in range(2*(n-k)):
   if i % 2 == 0:
    a.append(i+1)
   else:
    a.append(-i-1)
  for i in range(2*(n-k), n, 1):
   a.append(i+1)
 else:
  for i in range(2*k):
   if i % 2 == 0:
    a.append(i+1)
   else:
    a.append(-i-1)
 for i in a:
  print(i, end=" ")
 t -= 1


import sys
import math
import collections
import heapq
import queue
import itertools
import functools
import operator
import time

readline = sys.stdin.readline
 
IPS = lambda: readline().rstrip()
IP = lambda: int(readline().rstrip())
MP = lambda: map(int, readline().split())
LS = lambda: list(map(int, readline().split()))
AR = lambda: [int(x) for x in readline().split()]

def solve():
 for _ in range(IP()):
  n,k = MP()
  
  ans = [-x for x in range(1,n+1)]
 
  ans[0] = -ans[0]
  k-=1
  
  i, j = 1, -1
  if n&1 == 1: j = n-1
  else: j = n-2
  
  while k>0:
   if(i<n): ans[i] = -ans[i]; i+=2
   elif j>0: ans[j] = -ans[j]; j-=2
   k -= 1 
  
  for a in ans: print(a,end=" ")
  print()
  
def __starting_point():
 solve()
__starting_point()

test_case = int(input())
for i in range(0,test_case):
 line = input().split(' ')
 N = int (line[0])
 K = int (line[1])
 ans = []
 for i in range(1,N+1):
  if i%2==0:
   ans.append(0-i)
  else:
   ans.append(i)
 
 temp = K - int((N+1)/2)
 ind = N-1
 if temp>0:
  while temp>0:
   if ans[ind]<0:
    ans[ind] = 0-ans[ind]
    temp = temp - 1 
   ind = ind - 1
 else:
  temp = 0 - temp
  while temp>0:
   if ans[ind]>0:
    ans[ind] = 0-ans[ind]
    temp = temp -1
   ind = ind - 1
 for i in range(0,N):
  print(ans[i], end=" ")
 print()

t=int(input())
while(t>0):
 n,k=map(int,input().split())
 cnt = n/2
 diff = n-k

 if(k>cnt):
  for i in range(1,n+1):
   if(diff>0 and i%2==1):
    diff-=1
    print(-i,end=" ")
   else:
    print(i,end=" ")

 else:
  for i in range(1, n + 1):
   if(k>0 and i%2==0):
    k=k-1
    print(i,end=" ")
   else:
    print(-i,end=" ")

 print()
 t=t-1


import math
 
tc = int(input())
 
for _ in range(tc):
 
 n, k = map(int, input().split())
 
 ans = []
 for i in range(1, n+1):
  if i % 2 != 0:
   ans.append(i)
  else:
   ans.append(-i)
 
 positive = math.ceil(n/2)
 
 if positive > k:
  i = n-1
  needed = positive-k
  while needed > 0:
   if ans[i] > 0:
    ans[i] *= -1
    needed -= 1
   i -= 1
   
 if positive < k:
  i = n-1
  needed = k-positive
  while needed > 0:
   if ans[i] < 0:
    ans[i] *= -1
    needed -= 1
   i -= 1
   
 print(*ans)

# cook your dish here
import math
 
tc = int(input())
 
for _ in range(tc):
 
 n, k = map(int, input().split())
 
 ans = []
 for i in range(1, n+1):
  if i % 2 != 0:
   ans.append(i)
  else:
   ans.append(-i)
 
 positive = math.ceil(n/2)
 
 if positive > k:
  i = n-1
  needed = positive-k
  while needed > 0:
   if ans[i] > 0:
    ans[i] *= -1
    needed -= 1
   i -= 1
   
 if positive < k:
  i = n-1
  needed = k-positive
  while needed > 0:
   if ans[i] < 0:
    ans[i] *= -1
    needed -= 1
   i -= 1
   
 print(*ans)

# Post Prefixes
for t in range(int(input())):

 n, k = list(map(int, input().split())) # Two inputs
 flips = n - k
 A = []
 # Logic: Flip n-k numbers from i to (-i). First start with even numbers
 #        beginning from 2. If n-k > n/2 ie no of flips is greater than even
 #        numbers available, then flip remaining odd numbers starting from         the
 #        back, ie bigger numbers till total (n-k) numbers are flipped.

 for i in range(n):
  a = i
  if (i + 1) % 2 == 0 and flips > 0:  # If even and flips > 0, i = -i
   A.append(-(a+1))
   flips -= 1
  else:
   A.append(a+1)

 if flips > 0:  # If no. of flips still exist
  if n % 2:
   last_odd = n-1 # List is 0 based
  else:
   last_odd = n-2

  while (flips > 0):
   A[last_odd] *= -1
   flips -= 1
   last_odd -= 2

 print(*A)



import math
try :
 t=int(input())
 for i in range(t):
  n,k=map(int,input().split())
  h=math.ceil(n/2)
  l=[x*pow(-1,x+1) for x in range(1,n+1)]
  if k<h :
   for j in range(2*k,n):
    l[j]=-abs(l[j])
  elif k>h :
   if l[n-1]<0 : m=n-1
   else : m=n-2
   for j in range(k-h) :
    l[m]=-l[m]
    m=m-2
  for j in range(n):
   print(l[j],end=" ")
  print()
except :
 pass

# cook your dish here
import math
try:
 t=int(input())
 for _ in range (t):
  n,k=list(map(int,input().split()))
  seq=[]
  for i in range(1,n+1):
   if i%2!=0:
    seq.append(i)
   else:
    seq.append(-i)
  positive=math.ceil(n/2)
  if(positive>k):
   i=n-1
   req=positive-k
   while (req>0):
    if seq[i]>0:
     seq[i] =-(i+1)
     req -=1
    i -=1
  if(positive<k):
   i=n-1
   req=k-positive
   while (req>0):
    if seq[i]<0:
     seq[i] =(i+1)
     req -=1
    i -=1
  print(*seq)
except EOFError as t : pass
  


# cook your dish here
import math
try:
 t=int(input())
 for _ in range (t):
  n,k=list(map(int,input().split()))
  seq=[]
  for i in range(1,n+1):
   if i%2!=0:
    seq.append(i)
   else:
    seq.append(-i)
  positive=math.ceil(n/2)
  if(positive>k):
   i=n-1
   req=positive-k
   while (req>0):
    if seq[i]>0:
     seq[i] *=-1
     req -=1
    i -=1
  if(positive<k):
   i=n-1
   req=k-positive
   while (req>0):
    if seq[i]<0:
     seq[i] *=-1
     req -=1
    i -=1
  print(*seq)
except EOFError as t : pass
  


for i in range(int(input())):
 n,k=list(map(int,input().split()))
 l=[]
 pos=0
 for i in range(1,n+1):
  if i%2==0:
   l.append(-1*i)
  else:
   l.append(i)
   pos+=1
 if pos<k:
  g=k-pos
  c=0
  for i in range(n-1,-1,-1):
   if l[i]<0:
    l[i]=-1*l[i]
    c+=1
   if c==g:
    break
 if pos>k:
  g=pos-k
  c=0
  for i in range(n-1,-1,-1):
   if l[i]>0:
    l[i]=-1*l[i]
    c+=1
   if c==g:
    break
 print(*l)



# cook your dish here
from math import ceil
T = int(input())
for _ in range(T):
 N, K = map(int,input().split())
 L = []
 for i in range(1, N+1):
  if i%2==0:
   L.append(-i)
  else:
   L.append(i)
 C=ceil(N/2) 
 if K<=C: 
  d=C-K
  
  c=0
  for i in range(N-1,-1,-1):
   if c==d:
    break
   if L[i]>0:
    L[i]=-(L[i])
    c+=1
 else:
  d=K-C 
  c=0
  for i in range(N-1,-1,-1):
   if c==d:
    break
   if L[i]<0:
    L[i]=abs(L[i])
    c+=1
 print(*L)


# cook your dish here
for _ in range(int(input())):

 n, k = map(int, input().split())

 arr = []
 for i in range(n):
  if i%2==0:
   arr.append(i+1)
  else:
   arr.append(-i-1)

 pos = (n//2) + (n%2)
 neg = n//2
 
 if k<pos:
  for i in range(n-1, -1, -1):
   if k==pos:
    break
   if arr[i]>0:
    arr[i] = -arr[i]
    pos -= 1
 else:
  for i in range(n-1, -1, -1):
   if k==pos:
    break
   if arr[i]<0:
    arr[i] = -arr[i]
    pos += 1
   
 print(*arr)

# cook your dish here
for i in range(int(input())):
 n,k=list(map(int,input().split()))
 arr=[1]
 p=1
 ne=0
 m=0
 for j in range(2,n+1):
  if j%2==0:
   if p!=k:
    arr.append(j)
    p+=1
   else:
    m=1
    break
  else:
   if ne!=(n-k):
    arr.append(-j)
    ne+=1
   else:
    m=-1
    break
 
 if abs(arr[-1])!=n and m==-1:
  for x in range(arr[-1]+1,n+1):
   arr.append(x)
 elif abs(arr[-1])!=n and m==1:
  
  for x in range(abs(arr[-1])+1,n+1):
   
   arr.append(-x)
 print(*arr)
  
  


# cook your dish here
# Let's hack this code.

from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left, bisect_right 

mod = 1000000007

def L():
 return list(map(int, stdin.readline().split()))

def In():
 return map(int, stdin.readline().split())

def I():
 return int(stdin.readline())

def printIn(ob):
 return stdout.write(str(ob)+'\n')

def powerLL(n, p):
 result = 1
 while (p):
  if (p&1):
   result = result * n % mod
  p = int(p / 2)
  n = n * n % mod
 return result

#--------------------------------------

def myCode():
 n,k = In()
 seq = []
 for i in range(1,n+1):
  if i%2 == 0:
   seq.append(-i)
  else:
   seq.append(i)
 if k == math.ceil(n/2):
  print(*seq)
 elif k < math.ceil(n/2):
  req = abs(k - (math.ceil(n/2)))
  for i in range(n-1,-1,-1):
   if seq[i] > 0:
    seq[i] = -1 * seq[i]
    req -= 1
   if req == 0:
    break
  print(*seq)
 else:
  req = abs(k - (math.ceil(n/2)))
  for i in range(n-1,-1,-1):
   if seq[i] < 0:
    seq[i] = -1 * seq[i]
    req -= 1
   if req == 0:
    break
  print(*seq)
  
def main():
 for t in range(I()):
  myCode()
def __starting_point():
 main()
__starting_point()

# cook your dish her
import math
t=int(input())
while(t):
 n,k=list(map(int,input().split()))
 l=[]
 for i in range(1,n+1):
  if i%2==0:
   l.append(-i)
  else:
   l.append(i)
 mid=math.ceil(n/2)
 if mid>k:
  c=mid-k
  i=n-1
  while(c>0):
   if l[i]>0:
    l[i]=l[i]*-1
    c-=1
   i-=1
 if mid<k:
  c=k-mid
  j=n-1
  while(c>0):
   if l[j]<0:
    l[j]=l[j]*-1
    c-=1
   j-=1
   
 print(*l)
 t-=1


for _ in range(int(input())):
 a,b=map(int,input().split())
 arr=[0]*a
 for i in range(a):
  arr[i]=i+1
 x=0
 b=a-b
 if(b>a//2):
  x=b-a//2
  b=a//2
 #print(b,x)
 for i in range(b):
  arr[(2*i)+1]*=-1
 if(a%2==0):
  for i in range(x):
   arr[a-2*i-2]*=-1
 if(a%2!=0):
  for i in range(x):
   arr[a-2*i-1]*=-1
 print(*arr)

for _ in range(int(input())):
 N,K=map(int,input().split())
 cumsum=0
 coupo=0
 coune=0
 for i in range(N):
  if coupo==K:
   print(-(i+1), end=' ')
   coune+=1
   continue
  elif coune==N-K:
   print((i+1), end=' ')
   coupo+=1
   continue
  a=cumsum+(i+1)
  b=cumsum-(i+1)
  if abs(a)>abs(b):
   cumsum=b
   print(-(i+1), end=' ')
  else:
   cumsum=a
   print((i+1), end=' ')
  if cumsum>0:
   coupo+=1
  else:
   coune+=1
  
  
  


for _ in range(int(input())):
 N,K=map(int,input().split())
 po=K
 ne=N-K
 arr=[]
 cumsum=0
 coupo=0
 coune=0
 for i in range(N):
  if coupo==K:
   arr.append(-(i+1))
   coune+=1
   continue
  elif coune==ne:
   arr.append(i+1)
   coupo+=1
   continue
  a=cumsum+(i+1)
  b=cumsum-(i+1)
  if abs(a)>abs(b):
   cumsum=b
   arr.append(-(i+1))
  else:
   cumsum=a
   arr.append(i+1)
  if cumsum>0:
   coupo+=1
  else:
   coune+=1
 for i in range(len(arr)):
  print(arr[i],end=" ")