#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int t;
cin>>t;
for (int i=0;i<t;i++)
{
int n;
cin>>n;
int pierw = 0;
pierw = sqrt(n);
if(n % pierw == 0) cout<<"NIE"<<endl;
else cout<<"TAK"<<endl;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPiAKI2luY2x1ZGUgPG1hdGguaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsgCmludCBtYWluKCkgCnsgCiBpbnQgdDsKIGNpbj4+dDsKIGZvciAoaW50IGk9MDtpPHQ7aSsrKQogewogICBpbnQgbjsgCiAgIGNpbj4+bjsgCiAgICAKICAgaW50IHBpZXJ3ID0gMDsKICAgcGllcncgPSBzcXJ0KG4pOwogICBpZihuICUgcGllcncgPT0gMCkgY291dDw8Ik5JRSI8PGVuZGw7CiAgIGVsc2UgY291dDw8IlRBSyI8PGVuZGw7CiB9Cn0gCgoK