#include using namespace std; int main() { int q; cin >> q; for (int _ = 0; _ < q; _++) { int64_t n, k; cin >> n >> k; int64_t ans = 0; for (int64_t tmp = 1; tmp < n; tmp *= k) { ans++; } cout << ans << endl; } return 0; }