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