#include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(x,y) for(int x = 0;x < (y);x++) #define LLI long long int #define FORR(x,arr) for(auto& x:arr) #define ALL(a) (a.begin()),(a.end()) #define _L(x) cout<<(x)< class UF { public: vector _parent,_rank; UF() { _parent=_rank=vector(um,0); for(int i=0;i_rank[yRoot]) { _parent[xRoot] = yRoot; return yRoot; } if(_rank[xRoot]<_rank[yRoot]) { _parent[yRoot] = xRoot; return xRoot; } if(xRoot != yRoot) { _parent[yRoot] = xRoot; _rank[xRoot]++; return xRoot; } return xRoot; } }; int N; struct LargeValue { double C; LLI D; LargeValue multiply(const LargeValue& other) { double nextC = C * other.C; if(nextC >= 10) { return {nextC / 10.0, D + other.D + 1}; } return {nextC, D + other.D}; } void Export() { int a = (int)C; int b = (int)(C*10) % 10; cout << a << " " << b << " " << D << endl; } }; vector A(10001); vector B(10001); LargeValue ToLargeValue(LLI a) { LLI digit = 0; while(a >= 100) { digit++; a /= 10; } if(a >= 10) { return {(double)a/10.0, digit+1}; } return {(double)a, digit}; } LargeValue calculate(LLI a, LLI b) { auto copyB = b; auto seed = a; LargeValue source = {1.0, 0L}; while(copyB > 0) { if((copyB & 1) == 1) { source = source.multiply(ToLargeValue(seed)); } copyB >>= 1; seed *= seed; } return source; } int main() { cin >> N; FOR(i, N) { cin >> A[i]; cin >> B[i]; } FOR(i, N) { LargeValue result = calculate(A[i], B[i]); result.Export(); } return 0; }