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