import java.io.*; import java.util.*; import java.math.BigInteger; import java.util.Map.Entry; import static java.lang.Math.*; public class Solution extends PrintWriter { long[] min, max; Map mem = new HashMap<>(1_000_000); int[] solve(int n, int c) { if (n <= 2) { int[] ans = new int[n]; for (int i = 0; i < n; i++) { ans[i] = i; } return ans; } int[] ans = mem.get(key(n, c)); if (ans == null) { ans = new int[n]; c -= n - 1; for (int x = 0; x < n; x++) { int y = n - x - 1; long minXY = min[x] + min[y]; long maxXY = max[x] + max[y]; if (minXY <= c && c <= maxXY) { long xc = min[x]; long yc = c - xc; if (max[y] < yc) { xc += (yc - max[y]); yc = c - xc; } if (max[x] < xc) { yc += xc - max[x]; xc = c - yc; } int p = 0; ans[p++] = x; int[] l = solve(x, (int) xc); for (int i = 0; i < x; i++) { ans[p++] = l[i]; } int[] r = solve(y, (int) yc); for (int i = 0; i < y; i++) { ans[p++] = r[i] + x + 1; } // println(Arrays.toString(l) + " " + x + " " + Arrays.toString(r)); break; } } mem.put(key(n, c), ans); } return ans; } long key(long n, long m) { return (n << 32) | m; } int cnt(int n, int[] p) { if (n <= 1) { return 0; } int m = p[0]; int[] l = new int[n], r = new int[n]; int lp = 0, rp = 0; for (int i = 1; i < n; i++) { if (p[i] < m) { l[lp++] = p[i]; } else { r[rp++] = p[i]; } } return cnt(lp, l) + (n - 1) + cnt(rp, r); } void run() { int k = 100001; min = new long[k]; max = new long[k]; for (int i = 2; i < k; i++) { int len = i - 1; int x = len / 2; int y = len - x; min[i] = min[x] + len + min[y]; } for (int i = 0; i < k; i++) { max[i] = (i * (i - 1L)) / 2; } int t = nextInt(); for (int test = 0; test < t; test++) { int n = nextInt(), m = nextInt(); if (min[n] <= m && m <= max[n]) { int[] p = solve(n, m); for (int v : p) { print(v + 1); print(' '); } println(); } else { println(-1); } } } int[][] nextMatrix(int n, int m) { int[][] matrix = new int[n][m]; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) matrix[i][j] = nextInt(); return matrix; } String next() { while (!tokenizer.hasMoreTokens()) tokenizer = new StringTokenizer(nextLine()); return tokenizer.nextToken(); } boolean hasNext() { while (!tokenizer.hasMoreTokens()) { String line = nextLine(); if (line == null) { return false; } tokenizer = new StringTokenizer(line); } return true; } int[] nextArray(int n) { int[] array = new int[n]; for (int i = 0; i < n; i++) { array[i] = nextInt(); } return array; } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { try { return reader.readLine(); } catch (IOException err) { return null; } } public Solution(OutputStream outputStream) { super(outputStream); } static BufferedReader reader; static StringTokenizer tokenizer = new StringTokenizer(""); static Random rnd = new Random(); public static void main(String[] args) throws IOException { reader = new BufferedReader(new InputStreamReader(System.in)); Solution solution = new Solution(System.out); solution.run(); solution.close(); reader.close(); } }