#include <bits/stdc++.h>
using namespace std;
void test(){
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=k-3;i++){
		cout<<"1 ";
		n--;
	}
	if(n%2==1){
		cout<<"1 "<<n/2<<" "<<n/2<<"\n";
	}
	else if(n%4==2){
		cout<<(n/2)-1<<" "<<(n/2)-1<<" "<<"2\n";
	}
	else{
		cout<<n/4<<" "<<n/4<<" "<<n/2<<"\n";
	}
	
}
int main(){
	int t;
	cin>>t;
	while(t--){
		test();
	}
	return 0;
}