#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
    int N;
    cin >> N;

    for(int i=0;i<N;i++){
        int A, B;
        cin >> A >> B;

        long double l = logl(A) * B / logl(10);
        ll Z = l;
        int t = pow(10, l - Z + 1);
        int X = t / 10;
        int Y = t % 10;

        cout << X << " " << Y << " " << Z << endl;
    }

    return 0;
}