#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        int n,k;
        cin>>n>>k;
        int duodeshu=k-3;
        n=n-duodeshu;
        if(n%3==0){
            int ans=n/3;
            cout<<ans<<" "<<ans<<" "<<ans<<" ";
            for(int i=1;i<=duodeshu;i++){
                cout<<1<<" ";
            }
            cout<<endl;
        }
        else{
            if(n%2==1){
                cout<<1<<" "<<n/2<<" "<<n/2<<" ";
                for(int i=1;i<=duodeshu;i++){
                    cout<<1<<" ";
                }
                cout<<endl;
            }
            else{
                if(n%4==0){
                    cout<<n/4<<" "<<n/4<<" "<<n/2<<" ";
                    for(int i=1;i<=duodeshu;i++){
                        cout<<1<<" ";
                    }
                    cout<<endl;
                }
                else{
                    cout<<n/2-1<<" "<<n/2-1<<" "<<2<<" ";
                    for(int i=1;i<=duodeshu;i++){
                        cout<<1<<" ";
                    }
                    cout<<endl;
                }
            }
        }
    }
    return 0;
}