#include <bits/stdc++.h>
#define int long long
#define fast_reader ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n";
using namespace std;

vector<int> solve1(int n){
    if(n%2==1){
        int a=n/2;
        int b=a;
        int c=1;
        return {a, b, c};
    }
    else{
        n/=2;
        if(n%2==0){
            return {n, n/2, n/2};
        }
        else{
            return {n-1, n-1, 2};
        }
    }
    return {};
}

void solve(){
    int n, k;
    cin>>n>>k;
    auto arr=solve1(n-k+3);
    for (int i = 0; i < k; ++i) {
        cout << (i <3 ? arr[i] : 1) << ' '; 
    }
        cout << '\n';
}

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