#include <iostream>
using namespace std;
void solve(int x) {
    if(x&1) {
        printf("%d %d %d\n", 1, x/2, x/2);
    } else {
        int tmp = 1;
        while(x/2 >= 3 && (x&1) == 0) {
            x>>=1;
            tmp <<= 1;
        }
        if( x == 4) printf("%d %d %d\n", tmp, tmp, tmp*2);
        else printf("%d %d %d\n", tmp, x/2*tmp, x/2*tmp);
    }
}

void once() {
   int n, k;
    cin >> n >> k;
    while(k > 3) {
        cout << "1 ";
        k--;
        n--;
    }
    solve(n);
}
int main() {
    int t;
    cin >> t;
    while(t--) {
        once();
    }
}