#include <iostream>

using namespace std;

int main() {
	//freopen ("input.txt","r", stdin);
	//freopen ("output.txt","w", stdout);
	int t;
	cin >> t;
	while (t) {
		t--;
		int n, k;
		cin >> n >> k;
		while (k > 3) {
			cout << 1 << ' ';
			n--;
			k--;
		}
		if (n % 2 == 1) {
			cout << n / 2 << ' ' << n / 2 << ' ' << 1 << endl;
		}
		if (n % 4 == 0) {
			cout << n / 2 << ' ' << n / 4 << ' ' << n / 4 << endl;
		}
		if (n % 4 == 2) {
			cout << (n / 2) - 1 << ' ' << (n / 2) - 1 << ' ' << 2 << endl;
		} 
	}
	return 0;
}