#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

#define lowbit(x) ((x)&(-(x)))

using namespace std;

long long n, k;
int t;

int main()
{
	scanf("%d", &t);
	while (t--)
	{
		scanf("%lld%lld", &n, &k);
		while (k > 3)
		{
			printf("1 ");
			--k;
			--n;
		}
		if (n % 2)
		{
			printf("%lld %lld %lld\n", (long long)1, n / 2, n / 2);
			continue;
		}
		else
		{
			long long p = n / 2;
			if (p % 2 == 0)
			{
				printf("%lld %lld %lld\n", n / 2, n / 4, n / 4);
				continue;
			}
			else
			{
				printf("%lld %lld %lld\n", (long long)2, (p - 1), (p - 1));
				continue;
			}
		}
	}
	return 0;
}

