#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;

int T,n,m;

void solve(int x)
{
	if (x==0) return;
	if (x==4)
	{
		printf("1 1 2\n");
		return;
	}
	if (x%2==0)
		if ((x/2)%2==1)
			printf("%d %d %d\n",2,x/2-1,x/2-1);
		else 
			printf("%d %d %d\n",x/2,x/4,x/4);
	else
		printf("%d %d %d\n",1,x/2,x/2);
}

int main()
{
	scanf("%d",&T);
	for (int ii=1;ii<=T;ii++)
	{
		scanf("%d%d",&n,&m);
		for (int i=1;i<=m-3;i++)
			printf("1 ");
		solve(n-(m-3));
	}
	return 0;
}