#!/bin/python from itertools import permutations def lena_sort(nums): global numcalls if len(nums)==1: return nums less=[] more=[] pivot=nums[0] for i in range(1,len(nums)): numcalls+=1 if nums[i]0: sorted_less=lena_sort(less) else: sorted_less=[] if len(more)>0: sorted_more=lena_sort(more) else: sorted_more=[] ans=sorted_less+[pivot]+sorted_more return ans test=input() for i in range(test): length,c=map(int,raw_input().split()) k=0 numcalls=0 arr=[] Done=False for j in range(1,length+1): arr.append(j) alist=list(permutations(arr)) for t in alist: lena_sort(t) if numcalls==c: print ' '.join(map(str,t)) Done=True break numcalls=0 if Done is False: print int(-1)