#include <iostream>

using namespace std;

int t;
int n, k;

int main() {
	for (cin >> t; t--; ) {
		cin >> n >> k;
		for (n -= k - 3; k != 3; k--) {
			cout << 1 << ' ';
		}
		if (n == 3)
			cout << 1 << ' ' << 1 << ' ' << 1 << endl;
		else if (n % 4 == 0)
			cout << n / 2 << ' ' << n / 4 << ' ' << n / 4 << endl;
		else if (n % 4 == 1)
			cout << n / 2 << ' ' << n / 2 << ' ' << 1 << endl;
		else if (n % 4 == 2)
			cout << n / 2 - 1 << ' ' << n / 2 - 1 << ' ' << 2 << endl;
		else 
			cout << n / 2 << ' ' << n / 2 << ' ' << 1 << endl;
	}
	return 0;
}
