#include <bits/stdc++.h>
using namespace std;
int ldk[100005];
int main()
{
    //freopen("yeunhi.txt","r",stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t,n,k;
    cin >> t;
    while(t--)
    {
        cin >> n >> k;
        while(k>3)
        {
            cout << 1 <<" ";
            k--; n--;
        }
        if (n%2)
        {
            cout <<n/2<<" "<<n/2<<" "<<1<<endl;
        }
        else
        {
            if ((n/2)%2!=0)
            {n=n-2;
            cout<<2<<" "<<n/2<<" "<<n/2<<endl;
            }
            else cout <<n/2<<" "<<n/4<<" "<<n/4<<endl;
        }
    }
}
 