还是很简单的
#include <iostream>
using namespace std;
int n, a;
int main(){
cin >> n;
while (n --){
cin >> a;
for (int i = 2; i <= a / i; i ++){
int cnt = 0;
while (a % i == 0) a /= i, cnt ++;
if (cnt) cout << i << ' ' << cnt << endl;
}
if (a > 1) cout << a << " 1" << endl;
puts("");
}
return 0;
}