#include <bits/stdc++.h>
using namespace std;
void solve();
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
void solve() {
  long long n, k, i, j;
  cin >> n >> k;
  n -= (k - 3);
  if (n % 2 == 1) {
    cout << n / 2 << " " << n / 2 << " " << 1 << " ";
  } else {
    if (n % 4 == 0) {
      cout << n / 2 << " " << n / 4 << " " << n / 4 << " ";
    } else {
      cout << (n - 2) / 2 << " " << (n - 2) / 2 << " " << 2 << " ";
    }
  }
  for (i = 0; i < (k - 3); i++) cout << 1 << " ";
}
