#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); ll T, A, B; cin >> T; vector tb; for(int i = 1; i <= 99; i++)tb.push_back(log10(double(i) / 10)); while(T--){ cin >> A >> B; double ans = B * log10(A); ll s = lower_bound(tb.begin(), tb.end(), ans - floor(ans)) - tb.begin(); cout << s / 10 << " " << s % 10 << " " << (ll)(floor(ans)) << '\n'; } }