#include "bits/stdc++.h" using namespace std; #define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i)) #define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i)) #define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i)) static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL; typedef vector vi; typedef pair pii; typedef vector > vpii; typedef long long ll; template static void amin(T &x, U y) { if (y < x) x = y; } template static void amax(T &x, U y) { if (x < y) x = y; } int main() { int T; scanf("%d", &T); for (int ii = 0; ii < T; ++ ii) { int N; int C; scanf("%d%d", &N, &C); vector lo(N + 1), up(N + 1); rer(n, 2, N) lo[n] = (n - 1) + lo[(n - 1) / 2] + lo[n / 2]; rer(n, 2, N) up[n] = (n - 1) + up[n - 1]; if (C < lo[N] || up[N] < C) { puts("-1"); continue; } vector ans(N, -1); int num = 1; function solve = [&](int left, int right, int k) { int n = right - left; if (n == 0) return; if (n == 1) { ans[left] = num ++; return; } assert(lo[n] <= k && k <= up[n]); k -= n - 1; rep(i, n) { if (lo[i] + lo[n - 1 - i] <= k) { int l = (int)min(up[i], k - lo[n - 1 - i]); solve(left + 1, left + 1 + i, l); ans[left] = num ++; solve(left + 1 + i, right, k - l); return; } } assert(false); }; solve(0, N, C); for (int i = 0; i < (int)ans.size(); ++ i) { if (i != 0) putchar(' '); printf("%d", ans[i]); } puts(""); } return 0; }