#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep(i, N) for (int i = 0; i < N; i++) #define pb push_back typedef long long ll; typedef unsigned long long ull; typedef pair i_i; typedef pair ll_i; typedef pair d_i; typedef pair ll_ll; typedef pair d_d; struct edge { int v; ll w; }; // typedef complex C; ll MOD = 1000000007; ll _MOD = 1000000009; int INF = INT_MAX / 2; double EPS = 1e-10; ll lb[100001], ub[100001]; void f(int N, ll x, int l, vector& ans) { if (N == 0) return; x -= N - 1; int n; for (n = 0; ; n++) if (lb[n] + lb[N - 1 - n] <= x && x <= ub[n] + ub[N - 1 - n]) break; ll x1 = max(lb[n], x - ub[N - 1 - n]), x2 = x - x1; ans.pb(l + n); f(n, x1, l, ans); f(N - 1 - n, x2, l + n + 1, ans); } int main() { for (int x = 1; x <= 100000; x++) { lb[x] = (x - 1) + lb[x / 2] + lb[(x - 1) / 2]; ub[x] = (x - 1) + ub[x - 1]; } int T; cin >> T; while (T--) { int N; ll x; cin >> N >> x; if (lb[N] <= x && x <= ub[N]) { vector ans; f(N, x, 0, ans); rep(i, N) printf("%d%c", ans[i] + 1, i + 1 < N ? ' ' : '\n'); } else printf("-1\n"); } }