
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(), x.end()
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T> using o_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T, typename R> using o_map = tree<T, R, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define inf 1e9
#define MOD 1000000007

void solve() {
    int n , k ;cin >> n >> k ;
    if (n == 1 ) {
        cout << k << endl ;
        return ;
    }
    n--;
    cout << k << " ";
    ll numerateur =  0, denominateur   =0  ;
    vector <int >v ;
    for (int i = 1 ; i <=n ; i++) {
        if (i == n ) {
            cout << k << " ";
            continue ;
        }
        int x = n-i+1 , y = i  , plus1 = 0 , plus2 = 0;
        while (!(x%2)) {
            plus1++;
            x/=2;
        }
        while (!(y%2)) {
            plus2++;
            y/=2;
        }
        numerateur+=plus1 ;
        denominateur+=plus2 ;
        if (numerateur == denominateur) cout << k<< " ";
        else cout << 0<< " ";

    }
    cout << endl ;

}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t = 1;
    cin >> t;
    while (t--) {
        solve();
    }
}
