#include<bits/stdc++.h>
using namespace std;

void solve(void){
    int n,k;
    cin >> n >> k;
    while(k > 3) cout << "1 ",k--,n--;
    if(n % 2) cout << "1 " << (n - 1) / 2 << " " << (n - 1) / 2;
    else if(n % 4) cout << "2 " << (n - 2) / 2 << " " << (n - 2) / 2;
    else cout << n / 2 << " " << n / 4 << " " << n / 4;
    cout << "\n";
}

int main(void){

    ios::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    while(t--) solve();

    return 0;
}