#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
void divide(int x)
{
for(int i=2;i*i<x;i++)
{
int s=0;
while(x%i==0)
{
x /=i;
s++;
}
cout << i << ' ' << s << endl;
}
if(x>1) cout << x << ' ' << 1 << endl;
puts("");
return;
}
const int N = 110;
int t,n;
int main(void)
{
cin >> t;
while(t--)
{
cin >> n;
divide(n);
}
return 0;
}
很朴素的做法