#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <utility>
#include <map>
#include <vector>
#include <queue>
using namespace std;
typedef long long LL;
const LL N=1;
LL a[N];
void solve()
{
LL n,k;
cin>>n>>k;
for(int i=1;i<=k-3;i++)cout<<"1 ";//没想到k>=3可以从k==3转移过来
n=n-(k-3);
if(n%3==0)cout<<n/3<<" "<<n/3<<" "<<n/3<<endl;
else
{
if(n%2==0)
{
if((n/2)%2==0)cout<<(n/2)/2<<" "<<(n/2)/2<<" "<<(n)/2<<endl;
else cout<<"2"<<" "<<(n-2)/2<<" "<<(n-2)/2<<endl;
}
else cout<<"1"<<" "<<(n-1)/2<<" "<<(n-1)/2<<endl;
}
}
int main()
{
cin.tie(0);ios::sync_with_stdio(false);
LL tests=1;
//scanf("%d",&tests);
cin>>tests;
//while(~scanf("%d",&n))
while(tests--)
{
solve();
}
return 0;
}