#include <bits/stdc++.h>
using namespace std;
bool prime(int n) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    while (k > 3) {
      cout << 1 << " ";
      k--;
      n--;
    }
    bool prime(1127);
    if (n % 2 == 0) {
      if ((n / 2) % 2 == 0) {
        n = n / 2;
        cout << n << " " << n / 2 << " " << n / 2;
      } else {
        cout << 2 << " " << (n - 2) / 2 << " " << (n - 2) / 2;
      }
    } else {
      cout << 1 << " " << (n - 1) / 2 << " " << (n - 1) / 2;
    }
    cout << "\n";
  }
  return 0;
}
