#include using namespace std; using ll = long long; int main() { ll N; cin >> N; while (N--) { ll A, B; cin >> A >> B; long double logAB = B * log10((long double)A); ll ans = pow(10, logAB - (ll)logAB + 1 + 1e-8) + 1e-8; cout << ans / 10 << " " << ans % 10 << " " << (ll)logAB << endl; } }