#include "bits/stdc++.h" #define REP(i,n,N) for(ll i=(n); i<(N); i++) #define RREP(i,n,N) for(ll i=(N-1); i>=n; i--) #define CK(n,a,b) ((a)<=(n)&&(n)<(b)) #define ALL(v) (v).begin(),(v).end() #define p(s) cout<<(s)<> typedef long long ll; using namespace std; const int INF = 1e9; const int MOD = 1e9+7; const ll LLINF = 1e18; int main(){ ll N; ll A,B; cin>>N; double f; while(N--){ cin>>A>>B; f = log10(A)*B; A = f; B = pow(10,f-A+1); printf("%d %d %ld\n",B/10,B%10,A); } return 0; }