#include<bits/stdc++.h>
#define int long long
#define in  freopen("input.txt","r",stdin);
#define out freopen("output.txt","w",stdout);
#define r0cket007 in out 
using namespace std ;
signed main( )
{
	#ifndef ONLINE_JUDGE
    r0cket007
    #endif
	int testcases = 1 ;
	cin >> testcases ;
	while( testcases -- )
	{
		int n , k ;
		cin >> n >> k ;
		while( k != 3 ) 
		{
			cout << 1 << " " ;
			k -- ;
			n -- ;
		}
		
		if( n % 2 == 1 )
		{
			cout << 1 << " " << n / 2 << " " << n / 2 ;
		}
		else
		{
			if( n % 4 == 0 )
			{
				cout << n / 2 << " " << n / 4 << " " << n / 4 ;
			}
			else
			{
				cout << 2 << " " << ( n / 2 ) - 1 << " " << ( n / 2 ) - 1 ;
			}
		}
		cout << endl ;
	}
	cerr << "SUCCESS\n" ;
	return 0 ;
}