#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

struct fast_ios { fast_ios() { ios::sync_with_stdio(false); cin.tie(NULL); } } fast_ios_;

/*--------------------------------------------------*/

#define MOD (int)(1e9+7)
#define LINF (ll)1e18
#define INF (int)1e9

int solve() {
	int n, k; cin >> n >> k;
	int a = k-3;
	n -= a;
	if (n&1) printf("%d %d %d ", 1, n/2, n/2);
	else if (n%4) printf("%d %d %d ", 2, n/2-1, n/2-1);
	else printf("%d %d %d ", n/2, n/4, n/4);
	for (int i=0; i<a; ++i) printf("1 ");
	puts("");

	return 0;
}

int main() {
	int t; cin >> t;
	while (t--)
		solve();

	return 0;
}