#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
using i128 = __int128_t;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
if(!(cin >> T)) return 0;
while(T--){
int N;
int64 K;
cin >> N >> K;
// precompute pow2 up to N (as i128), but cap growth limited
vector<i128> pow2(N+2);
pow2[0] = 1;
for(int i=1;i<=N+1;i++){
pow2[i] = pow2[i-1] * 2;
// don't cap; i128 will hold until very large, division will handle it
}
// helper: compute max possible sum S for a given X
auto maxSumForX = [&](int64 X)->i128{
if(X <= 0) return (i128)0;
i128 cap = (i128)X - 1; // cap = X-1
if(cap <= 0) return (i128)0;
i128 best = 0;
// m from 0 .. N-2 (cases where we stop before using all N-1 steps)
for(int m=0; m <= max(0, N-2); ++m){
// B range: (floor(cap / 2^{m+1}) + 1) .. floor(cap / 2^{m})
i128 d1 = pow2[m+1];
i128 d2 = pow2[m];
i128 Bmin = (cap / d1) + 1;
i128 Bmax = (cap / d2);
if(Bmin <= Bmax && Bmax >= 1){
if(Bmin < 1) Bmin = 1;
// For this region, maximum S achieved at smallest B (S = X-1 - B)
i128 S = (i128)X - 1 - Bmin;
if(S > best) best = S;
}
// if d2 > cap and Bmax==0 then no valid B here
}
// m = N-1 case: all steps are full doubling (if possible)
if(N-1 >= 0){
i128 d = pow2[N-1];
if(d > 0){
i128 B = cap / d; // floor
if(B >= 1){
i128 S = (pow2[N-1] - 1) * B;
if(S > best) best = S;
}
}
}
return best;
};
// binary search minimal X in [1, K+1] (upper bound: A_N at most A1 + K, A1>=1)
int64 lo = 1, hi = K + 1; // inclusive search for minimal feasible X
while(lo < hi){
int64 mid = lo + (hi - lo) / 2;
i128 s = maxSumForX(mid);
if(s >= (i128)K) hi = mid;
else lo = mid + 1;
}
int64 X = lo;
// Now we must construct a sequence A of length N with A_N == X (or <=X but we use <=X and minimal X)
// Approach: try candidate starting A1 values (represented as B = A1 - 1)
// Candidate B's: Bmin/Bmax boundaries for m, plus ceil(K/(2^{N-1}-1)) candidate, plus small B fallback
vector<int64> candidatesB;
i128 cap = (i128)X - 1;
if(cap >= 1){
for(int m=0; m <= max(0, N-2); ++m){
i128 d1 = pow2[m+1];
i128 d2 = pow2[m];
i128 Bmin = (cap / d1) + 1;
i128 Bmax = (cap / d2);
if(Bmin <= Bmax && Bmax >= 1){
if(Bmin < 1) Bmin = 1;
// push both endpoints as candidates
candidatesB.push_back((int64)Bmin);
candidatesB.push_back((int64)min<i128>(Bmax, (i128)2e9));
}
}
// m = N-1 candidate: choose ceil(K / (2^{N-1}-1))
if(N-1 >= 0){
i128 denom = (pow2[N-1] - 1);
if(denom > 0){
i128 needB = ( (i128)K + denom - 1 ) / denom; // ceil
if(needB >= 1 && needB <= cap) candidatesB.push_back((int64)needB);
}
}
// some small Bs fallback (bounded by problem constraints)
int64 limitFallback = (int64)min<i128>(cap, (i128)200000);
for(int64 b=1; b<=limitFallback; ++b) candidatesB.push_back(b);
}
// add B=0 possibility (A1=1) too
candidatesB.push_back(0);
// unique candidates
sort(candidatesB.begin(), candidatesB.end());
candidatesB.erase(unique(candidatesB.begin(), candidatesB.end()), candidatesB.end());
// A helper: given B (=A1-1) and X produce sequence greedily and return sum produced and sequence
auto tryBuild = [&](int64 B)->pair<i128, vector<int64>>{
vector<int64> A;
A.reserve(N);
int64 a1 = B + 1;
A.push_back(a1);
i128 rem = K;
i128 cur = a1;
for(int i=1;i<=N-1;i++){
if(cur > (i128)X){
// impossible path
return make_pair((i128)-1, vector<int64>());
}
// compute r_max for this cur with cap X
i128 rmax;
if((i128)X >= 2*cur - 1) rmax = cur - 1;
else rmax = (i128)X - cur; // >=0 if cur<=X
if(rmax < 0) rmax = 0;
i128 take = rmax;
if(take > rem) take = rem;
i128 nxt = cur + take;
if(nxt > (i128)X) nxt = X; // safety
A.push_back((int64)nxt);
rem -= take;
cur = nxt;
}
return make_pair((i128)(K - rem), A); // returned sum actually produced
};
vector<int64> answer;
bool found = false;
for(int64 B : candidatesB){
if(B < 0) continue;
if((i128)B > cap) continue;
auto res = tryBuild(B);
i128 produced = res.first;
if(produced >= (i128)K){
// we have a valid construction (greedy may produce exactly K; if produced > K that's impossible because greedy never overshoots)
// but produced should equal K (since we restricted take<=rem). So produced==K
answer = res.second;
found = true;
break;
}
}
// As a last resort (shouldn't be needed), try brute force A1 from 1..min(X, 200000)
if(!found){
int64 limit = (int64)min<i128>((i128)X, (i128)200000);
for(int64 a1 = 1; a1 <= limit && !found; ++a1){
auto res = tryBuild(a1 - 1);
if(res.first >= (i128)K){
answer = res.second;
found = true;
break;
}
}
}
if(!found){
// Should not happen for a correct algorithm; fallback create trivial increasing sequence with last X
// But to be safe, output fallback (1,1,...,X)
answer.assign(N, 1);
answer[N-1] = X;
}
// ensure output length N
if((int)answer.size() != N){
// If our built vector shorter/longer, pad appropriately (should not happen)
vector<int64> tmp;
tmp.reserve(N);
for(int i=0;i<N;i++){
if(i < (int)answer.size()) tmp.push_back(answer[i]);
else tmp.push_back(answer.back());
}
answer.swap(tmp);
}
// Print
for(int i=0;i<N;i++){
if(i) cout << ' ';
cout << answer[i];
}
cout << '\n';
}
return 0;
}