#include <bits/stdc++.h>
using std::abs;
using std::cin;
using std::cout;
using std::deque;
using std::function;
using std::make_pair;
using std::map;
using std::max;
using std::min;
using std::numeric_limits;
using std::pair;
using std::set;
using std::stack;
using std::string;
using std::stringstream;
using std::tuple;
using std::unordered_map;
using std::vector;
using ll = long long;
int main() {
  std::ios_base::sync_with_stdio(0);
  std::cout.precision(17);
  int t;
  cin >> t;
  vector<int> res;
  for (int dummy_ = 0; (dummy_) < (int)(t); ++(dummy_)) {
    int n, m;
    cin >> n >> m;
    res.clear();
    for (int i = 0; (i) < (int)(m - 3); ++(i)) {
      res.push_back(1);
      --n;
    }
    if (n % 2 == 1) {
      res.push_back(1);
      res.push_back(n / 2);
      res.push_back(n / 2);
    } else if (n % 4 != 0) {
      res.push_back(2);
      res.push_back(n / 2 - 1);
      res.push_back(n / 2 - 1);
    } else {
      res.push_back(n / 2);
      res.push_back(n / 4);
      res.push_back(n / 4);
    }
    for (auto x : res) {
      cout << x << " ";
    }
    cout << std::endl;
  }
  return 0;
}
