include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
int main() {
int q;
cin >> q;
while(q – > 0) {
long long n, k; // 正整数n 阈值k
cin >> n >> k;
map[HTML_REMOVED] mp;
map[HTML_REMOVED]::iterator it;
for(int i = 2;i * i <= n;i ) {
while(n % i == 0) {
mp[i] ;
n = n / i;
}
}
mp[n] ;
long long ans = 1;
for(it = mp.begin();it != mp.end();it ) {
if(it->second >= k) {
for(int i = 0;i < it->second;i ++) {
ans = ans * it->first;
}
}
}
cout << ans << endl;
}
return 0;
}