#include<bits/stdc++.h>
using namespace std;
#define    ll    long long int
#define pi              2*acos(0.0)
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*b)/gcd(a,b)
map<ll,ll>mp,mk;
//map<string,ll>mp;
set<ll> s1,s2;
vector<int> v,w;
string s="",qq="",ss="",pp="";
char ch;
ll m,n,i,j,l,r,x,t,y,u,g,h,mn,mx,d,z,c,f,e,k,o;
int main ()
{
    cin>>t;
    while(t--)
    {
        cin>>n>>k;
        for(i=0; i<k-3; i++)
            cout<<"1 ";
        n=n-k+3;
        c=n-2;
        o=n/2;
        if(n%2)
            cout<<n/2<<" "<<n/2<<" "<<1;
        else if(o%2==0)
            cout<<n/2<<" "<<o/2<<" "<<o/2;
        else if(o%2)
            cout<<c/2<<" "<<c/2<<" "<<2;
        cout<<"\n";
    }
}
