#include <bits/stdc++.h>

using namespace std;


int main(){
    int t;
    cin>>t;
    while(t--){
        long long int n,k;
        cin>>n>>k;
        
        long long int x = n;
        long long int i=1;
        while(k>3){
            n--;
            k--;
            cout<<1<<" ";
        }
        
         if(n%3==0){
             cout<<n/3<<" "<<n/3<<" "<<n/3<<endl;
         }
         else{
             if(n%2==0){
                 if((n/2)%2!=0){
                 cout<<2<<" "<<(n-2)/2<<" "<<(n-2)/2<<endl;
                 }
                 else{
                     long long int y = n/2;
                     cout<<y/2<<" "<<y/2<<" "<<y<<endl;
                 }
             }
             else{
                 cout<<1<<" "<<(n-1)/2<<" "<<(n-1)/2<<endl;
             }
         }
    }
    
}