#include <bits/stdc++.h>                
using namespace std;
#define int long long
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t; cin>>t; while(t--) {
        int n,k; cin>>n>>k;
        for(int i = k; i > 3; --i, --n) cout<<1<<" ";
        if(n%3 == 0) cout<<n/3<<" "<<n/3<<" "<<n/3<<"\n";
        else {
            if(n%2 == 1) cout<<1<<" "<<(n-1)/2<<" "<<(n-1)/2<<"\n";
            else if(n%4 == 0) cout<<n/2<<" "<<n/4<<" "<<n/4<<"\n";
            else cout<<2<<" "<<(n-2)/2<<" "<<(n-2)/2<<"\n";
        }
    }
}