#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;

vector<int> solve(int N){
  int a,b,c;
    if(N&1){a=N/2;b=N/2;c=1;}
    else if(N%4==0){a=N/2;b=N/4;c=N/4;}
    else if(N%3==0){a=N/3;b=N/3;c=N/3;}
    else{
      for(int i=2;i<=N/2;i++){
        a = (N-i)/2; b=a;
        if(a%i==0||i%a==0){c=i;break;}
      }
    }
  return {a,b,c};
}

int main(){
  int T; cin>>T;
  while(T--){
    int N,K; cin>>N>>K;
    N-=(K-3);
    vector<int>ans = solve(N);
    for(int x:ans)cout<<x<<" ";
    for(int i=0;i<K-3;i++)cout<<1<<" ";
    cout<<endl;
  }
  return 0;
}