#include using namespace std; int main(){ int q;cin>>q; while(q--){ int a,b;cin>>a>>b; int cnt=0,n=1; while(n<=a){ n*=b;cnt++; } cout<