#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int T, A, B; cin >> T; while(T--){ cin >> A >> B; double ans = B * log10(A); double s = pow(10, ans - floor(ans)); s = floor(s * 10); cout << int(s) / 10 << " " << int(s) % 10 << " " << int(floor(ans)) << '\n'; } }