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

int main() {
	int t;
	cin >> t;
	while(t--) {
		int n,k;
		cin >> n >> k;
		for(int i=1;i<=k-3;i++) cout << 1 << " ";
		if((n-k+3) % 2) cout << 1 << " " << (n-k+3)/2 << " " << (n-k+3)/2 << '\n';
		else if((n-k+3)%2==0 && (n-k+3)%4) cout << 2 << " " << (n-k+3)/2-1 << " " <<  (n-k+3)/2-1 << '\n';
		else cout << (n-k+3)/2 << " " << (n-k+3)/4 << " " << (n-k+3)/4 << '\n';

	}
}
