#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int T;
string S;
int N;
signed long long pat[101];
signed long long p10[12];
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  p10[0] = 1;
  for (i = 0; i < (11); i++) p10[i + 1] = p10[i] * 10;
  cin >> T;
  while (T--) {
    cin >> S >> N;
    reverse((S.begin()), (S.end()));
    for (auto &c : S) c -= '0';
    while (1) {
      int sum = 0;
      for (auto &c : S) sum += c;
      if (sum >= N) break;
      for (i = 1; i < S.size(); i++)
        if (S[i]) {
          S[i]--;
          S[i - 1] += 10;
          break;
        }
    }
    memset(pat, 0, sizeof(pat));
    int cur = 0;
    for (i = 0; i < (S.size()); i++) {
      while (S[i]) {
        pat[cur] += p10[i];
        cur = (cur + 1) % N;
        S[i]--;
      }
    }
    for (i = 0; i < (N); i++) cout << pat[i] << " ";
    cout << endl;
  }
}
int main(int argc, char **argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false), cin.tie(0);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  cout.tie(0);
  solve();
  return 0;
}
