#include<bits/stdc++.h>
#define str to_string
using namespace std;
using ll=long long;
const int MAX=1e5+1;
const double EPS=1e-6;
ll lcm(ll a,ll b){
return a/__gcd(a,b)*b;
}
ll z,m;
bool check(ll l,ll r){
int now=lcm(l,1);
for(ll i=l+1;i<=r;i++)now=lcm(now,i);
return now==m;
}
void work(){
for(ll l=1;l<=3e2;l++){
for(ll r=l+1;r<=3e2;r++){
if(check(l,r)){
cout<<l<<' '<<r<<'\n';
return;
}
}
}
cout<<"NIE\n";
}
int main(){
cin>>z;
while(z--){
scanf("%lld",&m);
work();
}
return 0;
}