#include inline long nextInt(void) { long temp; std::cin >> temp; return temp; } int main() { long N; long A, B; double temp; long X, Y, Z; std::cin >> N; for(int i = 0; i < N; ++i) { std::cin >> A >> B; temp = B * log10(A); if( temp < 5 ) { X = pow(A, B); Z = 1; while( X >= 100 ) { Z += 1; X /= 10; } std::cout << X/10 << " " << X%10 << " " << Z << std::endl; continue; } Z = (int)temp; temp -= (int)temp; X = pow(10, temp) * 10; Y = X%10; X /= 10; std::cout << X << " " << Y << " " << Z << std::endl; } return 0; }