#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <deque>
#include <math.h>
using namespace std;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long z;
  cin >> z;
  //z = 1;
  while (z--)
  {
    long long int k = 0,
                  x = 0, y, z, s0 = 0, s1 = 0, s2 = 0, l, r, u,
                  s3 = 0, s5 = 0, s6 = 0, s4 = 0, p1 = 0, p2 = 0,
                  p3 = 0, ans = 0, mid = 0, n, m, i = 0, j = 0;
    cin >> n >> m;
    for (i = 1; i <= m - 3; i++)
      cout << "1 ";
    s1 = (n - (m - 3));
    n = s1;
    if (n % 2 != 0)
      cout << "1 " << (n - 1) / 2 << ' ' << (n - 1) / 2 << "\n";
    else
    {
      if ((n / 2) % 2 != 0)
        cout << "2 " << (n - 2) / 2 << ' ' << (n - 2) / 2 << "\n";
      else
        cout << n / 2 << ' ' << (n / 2) / 2 << ' ' << (n / 2) / 2 << "\n";
    }
  }
}
