#!/bin/python3 from itertools import permutations def lena_sort(array, counter): if len(array) <= 1: return (array, 0) pivot = array[0] less = [ ] more = [ ] for i in range(1, len(array)): counter += 1 if array[i] < pivot: less.append(array[i]) else: more.append(array[i]) sorted_less, val1 = lena_sort(less[:], 0) sorted_more, val2 = lena_sort(more[:], 0) ans = sorted_less + [pivot] + sorted_more counter += val1 counter += val2 return (ans, counter) q = int(input().strip()) for a0 in range(q): length,c = input().strip().split(' ') length,c = [int(length),int(c)] # your code goes here for i in permutations(range(1, length+1)): _, res = lena_sort(i, 0) if res == c: print(*i) break else: print(-1)