#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define mp make_pair #define pb push_back #define all(x) (x).begin(),(x).end() #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector vb; typedef vector vi; typedef vector vvb; typedef vector vvi; typedef pair pii; const int INF=1<<29; const double EPS=1e-9; const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1}; int main() { int N; cin >> N; for (int i = 0; i < N; i++) { int a, b; cin >> a >> b; long double l = ((long double)b) * log10(a); long double ll = l - ((long long int)l); long double lll = pow(10, ll); int ansX = (long long int)lll; int ansY = ((long long int)(lll * 10)) % 10; //cout << l << " " << ll << " " << lll << endl; cout << ansX << " " << ansY << " " << ((long long int)l) << endl; } return 0; }