#include using namespace std; signed main(){ int N; cin >> N; for( int i = 0; i < N; ++i ){ int A, B; cin >> A >> B; double v = log10( A ) * B; double h = pow( 10, v - floor( v ) ); int p = floor( v ); cout << ( int ) floor( h ) << " " << ( int ) ( 10.0 * ( h - floor( h ) ) ) << " " << p << endl; } return 0; }