using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void LenaSortComparisons(int len, int c) { int maxComparisons = (len - 1) * len / 2; if(maxComparisons < c) { Console.WriteLine(-1); return; } // e.g. len = 4 --> start = { 1, 2, 3, 4 } // which takes 3+2+1=6 comparisons to sort. int[] arr = Enumerable.Range(1, len).ToArray(); for(int piv = maxComparisons - c, k = 0; piv < len && piv != 0; ++k, ++piv) { int temp = arr[k]; arr[k] = arr[piv - 1]; arr[piv - 1] = temp; } Console.WriteLine(string.Join(" ", arr)); } static void Main(String[] args) { int q = Convert.ToInt32(Console.ReadLine()); for(int a0 = 0; a0 < q; a0++) { string[] tokens_len = Console.ReadLine().Split(' '); int len = Convert.ToInt32(tokens_len[0]); int c = Convert.ToInt32(tokens_len[1]); LenaSortComparisons(len, c); } } }